Struct foca::BincodeCodec

source ·
pub struct BincodeCodec<O: Options>(pub O);
Expand description

BincodeCodec encodes/decodes messages using bincode.

This struct simply wraps a bincode::Options type:

let codec =
    foca::BincodeCodec(bincode::DefaultOptions::new());

Tuple Fields§

§0: O

Trait Implementations§

source§

impl<O: Clone + Options> Clone for BincodeCodec<O>

source§

fn clone(&self) -> BincodeCodec<O>

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl<T, O> Codec<T> for BincodeCodec<O>
where T: Serialize + for<'de> Deserialize<'de>, O: Options + Copy,

§

type Error = Box<ErrorKind>

The codec error type. Will be wrapped by crate::Error.
source§

fn encode_header( &mut self, payload: &Header<T>, buf: impl BufMut ) -> Result<(), Self::Error>

Encodes a foca::Header into the given buffer.
source§

fn decode_header(&mut self, buf: impl Buf) -> Result<Header<T>, Self::Error>

Decode a Header from the given buffer. Read more
source§

fn encode_member( &mut self, member: &Member<T>, buf: impl BufMut ) -> Result<(), Self::Error>

Encodes a Member into the given buffer. Read more
source§

fn decode_member(&mut self, buf: impl Buf) -> Result<Member<T>, Self::Error>

Decode a Member from the given buffer. Read more
source§

impl<O: Debug + Options> Debug for BincodeCodec<O>

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl<O: Copy + Options> Copy for BincodeCodec<O>

Auto Trait Implementations§

§

impl<O> Freeze for BincodeCodec<O>
where O: Freeze,

§

impl<O> RefUnwindSafe for BincodeCodec<O>
where O: RefUnwindSafe,

§

impl<O> Send for BincodeCodec<O>
where O: Send,

§

impl<O> Sync for BincodeCodec<O>
where O: Sync,

§

impl<O> Unpin for BincodeCodec<O>
where O: Unpin,

§

impl<O> UnwindSafe for BincodeCodec<O>
where O: UnwindSafe,

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> Instrument for T

source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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> ToOwned for T
where T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

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

§

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>,

§

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.
source§

impl<T> WithSubscriber for T

source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more