pub struct CdrWriter { /* private fields */ }Expand description
Writes primitives as little-endian CDR, handling alignment padding.
The writer starts with the little-endian encapsulation header; each write aligns the cursor to the value’s size (measured from the start of the body) before appending the bytes.
§Examples
use pamoja_ros2::msg::CdrWriter;
let mut w = CdrWriter::new();
w.write_f64(1.0);
// Four-byte header plus eight bytes for the double.
assert_eq!(w.into_bytes().len(), 12);Implementations§
Source§impl CdrWriter
impl CdrWriter
Sourcepub fn into_bytes(self) -> Vec<u8>
pub fn into_bytes(self) -> Vec<u8>
Consumes the writer and returns the encoded bytes, header included.
§Returns
The CDR-encoded buffer.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for CdrWriter
impl RefUnwindSafe for CdrWriter
impl Send for CdrWriter
impl Sync for CdrWriter
impl Unpin for CdrWriter
impl UnsafeUnpin for CdrWriter
impl UnwindSafe for CdrWriter
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more