Struct bytecodec::fixnum::U16beEncoder[][src]

pub struct U16beEncoder(_);
Expand description

Encoder which encodes u16 values by big-endian byte order.

Examples

use bytecodec::EncodeExt;
use bytecodec::fixnum::U16beEncoder;
use bytecodec::io::IoEncodeExt;

let mut output = Vec::new();
let mut encoder = U16beEncoder::with_item(0x0102).unwrap();
encoder.encode_all(&mut output).unwrap();
assert_eq!(output, [0x01, 0x02]);

Implementations

Makes a new U16beEncoder instance.

Trait Implementations

Formats the value using the given formatter. Read more

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

The type of items to be encoded.

Encodes the items in the encoder and writes the encoded bytes to the given buffer. Read more

Tries to start encoding the given item. Read more

Returns the number of bytes required to encode all the items in the encoder. Read more

Returns true if there are no items to be encoded in the encoder, otherwise false. Read more

Returns the exact number of bytes required to encode all the items remaining in the encoder.

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Performs the conversion.

Performs the conversion.

Encodes the items remaining in the encoder and writes the encoded bytes to the given write buffer. Read more

Encodes the items remaining in the encoder and writes the encoded bytes to the given write buffer. If the write buffer is full and the writing cannot be performed, the given WriteBuf will memorize cx’s Waker. This Waker’s wake will later be called when the WriteBuf regains its free space. Read more

Encodes all of the items remaining in the encoder and writes the encoded bytes to the given writer. Read more

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.