⚠️ VeridianOS Kernel Documentation - This is low-level kernel code. All functions are unsafe unless explicitly marked otherwise. no_std

XdrEncoder

Struct XdrEncoder 

Source
pub struct XdrEncoder { /* private fields */ }
Expand description

XDR (RFC 4506) encoder for NFS wire format.

Implementations§

Source§

impl XdrEncoder

Source

pub fn new() -> Self

Create a new encoder.

Source

pub fn with_capacity(cap: usize) -> Self

Create encoder with pre-allocated capacity.

Source

pub fn encode_u32(&mut self, v: u32)

Encode a u32.

Source

pub fn encode_u64(&mut self, v: u64)

Encode a u64.

Source

pub fn encode_bool(&mut self, v: bool)

Encode a bool.

Source

pub fn encode_opaque(&mut self, data: &[u8])

Encode an opaque byte array (length-prefixed, padded to 4-byte boundary).

Source

pub fn encode_string(&mut self, s: &str)

Encode a string (same as opaque).

Source

pub fn encode_opaque_fixed(&mut self, data: &[u8])

Encode a fixed-size opaque array (no length prefix, padded).

Source

pub fn into_bytes(self) -> Vec<u8>

Consume the encoder and return the buffer.

Source

pub fn len(&self) -> usize

Current encoded length.

Source

pub fn is_empty(&self) -> bool

Whether the buffer is empty.

Trait Implementations§

Source§

impl Default for XdrEncoder

Available on crate feature alloc only.
Source§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto Trait Implementations§

§

impl Freeze for XdrEncoder

§

impl RefUnwindSafe for XdrEncoder

§

impl Send for XdrEncoder

§

impl Sync for XdrEncoder

§

impl Unpin for XdrEncoder

§

impl UnwindSafe for XdrEncoder

Blanket Implementations§

§

impl<T> Any for T
where T: 'static + ?Sized,

§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
§

impl<T> Borrow<T> for T
where T: ?Sized,

§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
§

impl<T> BorrowMut<T> for T
where T: ?Sized,

§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
§

impl<T> From<T> for T

§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T, U> Into<U> for T
where U: From<T>,

§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of [From]<T> for U chooses to do.

§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.