Skip to main content

Writer

Trait Writer 

Source
pub trait Writer<F> {
    // Required methods
    fn write_opaque_variable(&mut self, bytes: &[u8]) -> Result<(), WriteError>;
    fn write_i64(&mut self, n: i64) -> Result<(), WriteError>;
    fn write_i32(&mut self, n: i32) -> Result<(), WriteError>;
    fn write_i16(&mut self, n: i16) -> Result<(), WriteError>;
    fn write_u64(&mut self, n: u64) -> Result<(), WriteError>;
    fn write_u32(&mut self, n: u32) -> Result<(), WriteError>;
    fn write_u16(&mut self, n: u16) -> Result<(), WriteError>;
    fn write_bool(&mut self, b: bool) -> Result<(), WriteError>;
    fn write_f32(&mut self, n: f32) -> Result<(), WriteError>;
    fn write_f64(&mut self, n: f64) -> Result<(), WriteError>;
}
Expand description

Something that can write XDR values to a serialization format.

This trait provides methods for writing XDR primitive types to an underlying serialization format. The type parameter F represents the format being written (e.g., CXS or TXS).

Implementations of this trait are used by WriteXDR to serialize complex types.

Required Methods§

Source

fn write_opaque_variable(&mut self, bytes: &[u8]) -> Result<(), WriteError>

Writes a byte sequence of variable length.

Source

fn write_i64(&mut self, n: i64) -> Result<(), WriteError>

Writes a signed 64-bit integer.

Source

fn write_i32(&mut self, n: i32) -> Result<(), WriteError>

Writes a signed 32-bit integer.

Source

fn write_i16(&mut self, n: i16) -> Result<(), WriteError>

Writes a signed 16-bit integer.

Source

fn write_u64(&mut self, n: u64) -> Result<(), WriteError>

Writes an unsigned 64-bit integer.

Source

fn write_u32(&mut self, n: u32) -> Result<(), WriteError>

Writes an unsigned 32-bit integer.

Source

fn write_u16(&mut self, n: u16) -> Result<(), WriteError>

Writes an unsigned 16-bit integer.

Source

fn write_bool(&mut self, b: bool) -> Result<(), WriteError>

Writes a boolean value.

Source

fn write_f32(&mut self, n: f32) -> Result<(), WriteError>

Writes a 32-bit IEEE 754 floating-point value.

Source

fn write_f64(&mut self, n: f64) -> Result<(), WriteError>

Writes a 64-bit IEEE 754 floating-point value.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§

Source§

impl<P> Writer<CXS> for P
where P: Put,

Source§

impl<P> Writer<TXS> for P
where P: Put,