Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions libp2panda/src/topic.rs
Original file line number Diff line number Diff line change
Expand Up @@ -217,6 +217,21 @@ pub unsafe extern "C" fn p2panda_topic_id_new() -> *mut topic::TopicId {
topic::TopicId::new().into_glib_ptr()
}

#[unsafe(no_mangle)]
pub unsafe extern "C" fn p2panda_topic_id_new_from_data(
data: *const [u8; 32],
) -> *mut topic::TopicId {
unsafe { topic::TopicId::from_data(*data).into_glib_ptr() }
}

#[unsafe(no_mangle)]
pub unsafe extern "C" fn p2panda_topic_id_get_data(topic_id: *mut topic::TopicId) -> *const [u8; 32] {
unsafe {
let topic_id = topic::TopicId::from_glib_none(topic_id);
topic_id.into_glib_ptr() as *const [u8; 32]
}
}

#[unsafe(no_mangle)]
pub unsafe extern "C" fn p2panda_topic_id_copy(
topic_id: *mut topic::TopicId,
Expand Down
Loading