SimpleBinaryEncodable

Trait SimpleBinaryEncodable 

Source
pub trait SimpleBinaryEncodable {
    // Required methods
    fn byte_len(&self) -> usize;
    fn encode<S: Write + ?Sized>(&self, stream: &mut S) -> EncodingResult<()>;

    // Provided method
    fn encode_to_vec(&self) -> Vec<u8>  { ... }
}
Expand description

Trait for encoding a type that cannot contain any custom types to OPC UA binary. Used in some core modules to encode raw binary messages.

Required Methods§

Source

fn byte_len(&self) -> usize

This may be called prior to writing to ensure the correct amount of space is available.

Source

fn encode<S: Write + ?Sized>(&self, stream: &mut S) -> EncodingResult<()>

Encodes the instance to the write stream.

Provided Methods§

Source

fn encode_to_vec(&self) -> Vec<u8>

Convenience method for encoding a message straight into an array of bytes. It is preferable to reuse buffers than to call this so it should be reserved for tests and trivial code.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementations on Foreign Types§

Source§

impl SimpleBinaryEncodable for bool

Source§

fn byte_len(&self) -> usize

Source§

fn encode<S: Write + ?Sized>(&self, stream: &mut S) -> EncodingResult<()>

Source§

impl SimpleBinaryEncodable for f32

An IEEE single precision (32 bit) floating point value.

Source§

fn byte_len(&self) -> usize

Source§

fn encode<S: Write + ?Sized>(&self, stream: &mut S) -> EncodingResult<()>

Source§

impl SimpleBinaryEncodable for f64

An IEEE double precision (64 bit) floating point value.

Source§

fn byte_len(&self) -> usize

Source§

fn encode<S: Write + ?Sized>(&self, stream: &mut S) -> EncodingResult<()>

Source§

impl SimpleBinaryEncodable for i8

Source§

fn byte_len(&self) -> usize

Source§

fn encode<S: Write + ?Sized>(&self, stream: &mut S) -> EncodingResult<()>

Source§

impl SimpleBinaryEncodable for i16

A signed integer value between −32768 and 32767.

Source§

fn byte_len(&self) -> usize

Source§

fn encode<S: Write + ?Sized>(&self, stream: &mut S) -> EncodingResult<()>

Source§

impl SimpleBinaryEncodable for i32

A signed integer value between −2147483648 and 2147483647.

Source§

fn byte_len(&self) -> usize

Source§

fn encode<S: Write + ?Sized>(&self, stream: &mut S) -> EncodingResult<()>

Source§

impl SimpleBinaryEncodable for i64

A signed integer value between −9223372036854775808 and 9223372036854775807.

Source§

fn byte_len(&self) -> usize

Source§

fn encode<S: Write + ?Sized>(&self, stream: &mut S) -> EncodingResult<()>

Source§

impl SimpleBinaryEncodable for u8

An unsigned byt integer value between 0 and 255.

Source§

fn byte_len(&self) -> usize

Source§

fn encode<S: Write + ?Sized>(&self, stream: &mut S) -> EncodingResult<()>

Source§

impl SimpleBinaryEncodable for u16

An unsigned integer value between 0 and 65535.

Source§

fn byte_len(&self) -> usize

Source§

fn encode<S: Write + ?Sized>(&self, stream: &mut S) -> EncodingResult<()>

Source§

impl SimpleBinaryEncodable for u32

An unsigned integer value between 0 and 4294967295.

Source§

fn byte_len(&self) -> usize

Source§

fn encode<S: Write + ?Sized>(&self, stream: &mut S) -> EncodingResult<()>

Source§

impl SimpleBinaryEncodable for u64

An unsigned integer value between 0 and 18446744073709551615.

Source§

fn byte_len(&self) -> usize

Source§

fn encode<S: Write + ?Sized>(&self, stream: &mut S) -> EncodingResult<()>

Implementors§