Struct bcder::encode::Slice

source ·
pub struct Slice<T, F, U, V>
where T: AsRef<[U]>, F: Fn(&U) -> V,
{ /* private fields */ }
Expand description

A wrapper for a slice of encodable values.

A value of this type will take something that can provide a reference to a slice of some value and a closure that converts the values of the slice into something encodable.

Implementations§

source§

impl<T, F, U, V> Slice<T, F, U, V>
where T: AsRef<[U]>, F: Fn(&U) -> V,

source

pub fn new(value: T, f: F) -> Self

Creates a new wrapper for a given value and closure.

Trait Implementations§

source§

impl<T, F, U, V> Values for Slice<T, F, U, V>
where T: AsRef<[U]>, F: Fn(&U) -> V, V: Values,

source§

fn encoded_len(&self, mode: Mode) -> usize

Returns the length of the encoded values for the given mode.
source§

fn write_encoded<W: Write>( &self, mode: Mode, target: &mut W ) -> Result<(), Error>

Encodes the values in the given mode and writes them to target.
source§

fn explicit(self, tag: Tag) -> Constructed<Self>
where Self: Sized,

Converts the encoder into one with an explicit tag.
source§

fn to_captured(&self, mode: Mode) -> Captured

Captures the encoded values in the given mode.

Auto Trait Implementations§

§

impl<T, F, U, V> RefUnwindSafe for Slice<T, F, U, V>

§

impl<T, F, U, V> Send for Slice<T, F, U, V>
where F: Send, T: Send, U: Send, V: Send,

§

impl<T, F, U, V> Sync for Slice<T, F, U, V>
where F: Sync, T: Sync, U: Sync, V: Sync,

§

impl<T, F, U, V> Unpin for Slice<T, F, U, V>
where F: Unpin, T: Unpin, U: Unpin, V: Unpin,

§

impl<T, F, U, V> UnwindSafe for Slice<T, F, U, V>

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

§

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.