Skip to content

Commit e2f36a0

Browse files
committed
add new entrypoint for serilizing ChannelManager
1 parent 9cf8e78 commit e2f36a0

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

bindings/src/channelmanager.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -285,6 +285,12 @@ ffi! {
285285
into_fixed_buffer(&mut e, buf, &mut actual_channels_len)
286286
}
287287

288+
fn serialize_channel_manager(buf_out: Out<u8>, buf_len: usize, actual_len: Out<usize>, handle: FFIArcChannelManagerHandle) -> FFIResult {
289+
let buf = unsafe_block!("The buffer lives as long as this function, the length is within the buffer and the buffer won't be read before initialization" => buf_out.as_uninit_bytes_mut(buf_len));
290+
let mut chan_man: &FFIArcChannelManager = unsafe_block!("We know handle points to valid channel_manager" => handle.as_ref());
291+
into_fixed_buffer(&mut chan_man, buf, &mut actual_len)
292+
}
293+
288294
fn release_ffi_channel_manager(handle: FFIArcChannelManagerHandle) -> FFIResult {
289295
unsafe_block!("The upstream caller guarantees the handle will not be accessed after being freed" => FFIArcChannelManagerHandle::dealloc(handle, |mut handle| {
290296
FFIResult::ok()

0 commit comments

Comments
 (0)