pub struct XdrEncoder { /* private fields */ }Expand description
XDR encoder that writes into a pre-allocated Vec<u8>.
Implementations§
Source§impl XdrEncoder
impl XdrEncoder
Sourcepub fn encode_u32(&mut self, v: u32)
pub fn encode_u32(&mut self, v: u32)
Encode a 32-bit unsigned integer (big-endian).
Sourcepub fn encode_i32(&mut self, v: i32)
pub fn encode_i32(&mut self, v: i32)
Encode a 32-bit signed integer (big-endian).
Sourcepub fn encode_u64(&mut self, v: u64)
pub fn encode_u64(&mut self, v: u64)
Encode a 64-bit unsigned integer (big-endian, as two u32s).
Sourcepub fn encode_i64(&mut self, v: i64)
pub fn encode_i64(&mut self, v: i64)
Encode a 64-bit signed integer (big-endian).
Sourcepub fn encode_bool(&mut self, v: bool)
pub fn encode_bool(&mut self, v: bool)
Encode a boolean as a u32 (0 or 1).
Sourcepub fn encode_opaque(&mut self, data: &[u8])
pub fn encode_opaque(&mut self, data: &[u8])
Encode variable-length opaque data: u32 length + data + padding to 4-byte boundary.
Sourcepub fn encode_opaque_fixed(&mut self, data: &[u8])
pub fn encode_opaque_fixed(&mut self, data: &[u8])
Encode fixed-length opaque data (no length prefix, just data + padding).
Sourcepub fn encode_string(&mut self, s: &str)
pub fn encode_string(&mut self, s: &str)
Encode a UTF-8 string (same wire format as opaque).
Sourcepub fn encode_raw(&mut self, data: &[u8])
pub fn encode_raw(&mut self, data: &[u8])
Append raw bytes without XDR framing (no length prefix, no padding).
Sourcepub fn into_bytes(self) -> Vec<u8> ⓘ
pub fn into_bytes(self) -> Vec<u8> ⓘ
Consume the encoder and return the encoded bytes.
Auto Trait Implementations§
impl Freeze for XdrEncoder
impl RefUnwindSafe for XdrEncoder
impl Send for XdrEncoder
impl Sync for XdrEncoder
impl Unpin for XdrEncoder
impl UnsafeUnpin for XdrEncoder
impl UnwindSafe for XdrEncoder
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
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more