Skip to main content

AirbenderCodecV0

Struct AirbenderCodecV0 

Source
pub struct AirbenderCodecV0;
Expand description

Initial codec based on bincode v2 with a fixed configuration.

Implementations§

Source§

impl AirbenderCodecV0

Source

pub fn decode_from_reader<T, R>(reader: &mut R) -> Result<T, CodecError>

Decode a value from a streaming FramedRead source using the same configuration as AirbenderCodec::decode.

Unlike the slice-based decode, the end-of-input check is left to the caller: a reader knows the frame bounds, bincode does not. Callers that need the codec’s trailing-byte strictness should verify the reader is fully consumed and raise CodecError::TrailingBytes themselves (see airbender_core::wire::FramedReader::remaining).

For DeserializeOwned types this consumes exactly the same bytes with the same validation as decode. One failure-mode difference: a deserialize_bytes visitor (e.g. serde_bytes) is served zero-copy by the slice path but goes through Vec<u8>::decode here, which allocates the claimed length up front — so a bogus inner length fails as an allocation abort rather than a clean DecodeError. Ordinary Vec<u8> and String fields are unaffected (both paths allocate up front).

Trait Implementations§

Source§

impl AirbenderCodec for AirbenderCodecV0

Source§

const VERSION: u32 = AIRBENDER_CODEC_V0

Version identifier baked into manifests and tooling.
Source§

fn encode<T>(value: &T) -> Result<Vec<u8>, CodecError>
where T: Serialize,

Serialize a value into a byte payload.
Source§

fn decode<T>(bytes: &[u8]) -> Result<T, CodecError>

Deserialize a value from a byte payload.

Auto Trait Implementations§

Blanket Implementations§

Source§

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

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

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

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

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

Source§

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

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

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

Source§

fn into(self) -> U

Calls U::from(self).

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

Source§

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

Source§

type Error = Infallible

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

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

Performs the conversion.
Source§

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

Source§

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

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

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

Performs the conversion.