Struct codec_sv2::Sv2Frame

source ·
pub struct Sv2Frame<T, B> { /* private fields */ }

Implementations§

source§

impl<A, B> Sv2Frame<A, B>

source

pub fn map<C>(self, fun: fn(_: A) -> C) -> Sv2Frame<C, B>

Trait Implementations§

source§

impl<T, B> Clone for Sv2Frame<T, B>
where T: Clone, B: Clone,

source§

fn clone(&self) -> Sv2Frame<T, B>

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, B> Debug for Sv2Frame<T, B>
where T: Debug, B: Debug,

source§

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

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

impl<T, B> Default for Sv2Frame<T, B>

source§

fn default() -> Sv2Frame<T, B>

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

impl<'a, T, B> Frame<'a, T> for Sv2Frame<T, B>
where T: Encodable + GetSize, B: AsMut<[u8]> + AsRef<[u8]>,

source§

fn serialize(self, dst: &mut [u8]) -> Result<(), Error>

Serialize the frame into dst if the frame is already serialized it just swap dst with itself

source§

fn get_header(&self) -> Option<Header>

If is an Sv2 frame return the Some(header) if it is a noise frame return None

source§

fn from_bytes( bytes: <Sv2Frame<T, B> as Frame<'a, T>>::Buffer ) -> Result<Sv2Frame<T, B>, isize>

Try to build a Frame frame from raw bytes. It return the frame or the number of the bytes needed to complete the frame The resulting frame is just a header plus a payload with the right number of bytes nothing is said about the correctness of the payload

source§

fn from_message( message: T, message_type: u8, extension_type: u16, channel_msg: bool ) -> Option<Sv2Frame<T, B>>

Try to build an Frame frame from a serializable payload. It returns a Frame if the size of the payload fits in the frame, if not it returns None

§

type Buffer = B

§

type Deserialized = B

source§

fn payload(&'a mut self) -> &'a mut [u8]

source§

fn from_bytes_unchecked( bytes: <Sv2Frame<T, B> as Frame<'a, T>>::Buffer ) -> Sv2Frame<T, B>

source§

fn size_hint(bytes: &[u8]) -> isize

source§

fn encoded_length(&self) -> usize

source§

impl<T, B> From<Sv2Frame<T, B>> for EitherFrame<T, B>

source§

fn from(v: Sv2Frame<T, B>) -> EitherFrame<T, B>

Converts to this type from the input type.
source§

impl<T, B> TryFrom<EitherFrame<T, B>> for Sv2Frame<T, B>

§

type Error = Error

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

fn try_from(v: EitherFrame<T, B>) -> Result<Sv2Frame<T, B>, Error>

Performs the conversion.

Auto Trait Implementations§

§

impl<T, B> Freeze for Sv2Frame<T, B>
where B: Freeze, T: Freeze,

§

impl<T, B> RefUnwindSafe for Sv2Frame<T, B>

§

impl<T, B> Send for Sv2Frame<T, B>
where B: Send, T: Send,

§

impl<T, B> Sync for Sv2Frame<T, B>
where B: Sync, T: Sync,

§

impl<T, B> Unpin for Sv2Frame<T, B>
where B: Unpin, T: Unpin,

§

impl<T, B> UnwindSafe for Sv2Frame<T, B>
where B: UnwindSafe, T: 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, 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> Same for T

§

type Output = T

Should always be Self
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.