Sv2Option

Struct Sv2Option 

Source
pub struct Sv2Option<'a, T>(pub Vec<T>, _);
Expand description

The lifetime ’a is defined.

Tuple Fields§

§0: Vec<T>

Implementations§

Source§

impl<T: Fixed> Sv2Option<'_, T>

Source

pub fn into_static(self) -> Sv2Option<'static, T>

converts the lifetime to static

Source§

impl<'a, const ISFIXED: bool, const SIZE: usize, const HEADERSIZE: usize, const MAXSIZE: usize> Sv2Option<'a, Inner<'a, ISFIXED, SIZE, HEADERSIZE, MAXSIZE>>

Source

pub fn into_static( self, ) -> Sv2Option<'static, Inner<'static, ISFIXED, SIZE, HEADERSIZE, MAXSIZE>>

converts the lifetime to static

Source§

impl<'a, const SIZE: usize> Sv2Option<'a, Inner<'a, true, SIZE, 0, 0>>

Source

pub fn to_option(&self) -> Option<Vec<u8>>

Gets the owned first element of the sequence, if present

Source

pub fn inner_as_ref(&self) -> Option<&[u8]>

Gets the reference to first element of the sequence, if present

Source§

impl<'a, T: 'a> Sv2Option<'a, T>

Source

pub fn new(inner: Option<T>) -> Self

Initializes a new option type

Source

pub fn into_inner(self) -> Option<T>

Gets the inner value of Sv2Option

Trait Implementations§

Source§

impl<'a, T: Clone> Clone for Sv2Option<'a, T>

Source§

fn clone(&self) -> Sv2Option<'a, T>

Returns a duplicate 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<'a, T: Debug> Debug for Sv2Option<'a, T>

Source§

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

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

impl<'a, T: 'a + Sv2DataType<'a> + GetMarker + GetSize + Decodable<'a>> Decodable<'a> for Sv2Option<'a, T>

Source§

fn get_structure(data: &[u8]) -> Result<Vec<FieldMarker>, Error>

Defines the expected structure of a type based on binary data. Read more
Source§

fn from_decoded_fields(data: Vec<DecodableField<'a>>) -> Result<Self, Error>

Constructs the type from a vector of decoded fields. Read more
Source§

fn from_bytes(data: &'a mut [u8]) -> Result<Self, Error>

Decodes the type from raw bytes. Read more
Source§

impl Display for Sv2Option<'_, u32>

Source§

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

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

impl<'a> From<Sv2Option<'a, Inner<'a, false, 1, 1, 255>>> for EncodableField<'a>

Source§

fn from(v: Sv2Option<'_, B0255<'a>>) -> Self

Converts to this type from the input type.
Source§

impl<'a> From<Sv2Option<'a, Inner<'a, false, 1, 2, { u16::MAX as usize }>>> for EncodableField<'a>

Source§

fn from(v: Sv2Option<'_, B064K<'a>>) -> Self

Converts to this type from the input type.
Source§

impl<'a> From<Sv2Option<'a, Inner<'a, false, 1, 3, { 2_usize.pow(24) - 1 }>>> for EncodableField<'a>

Source§

fn from(v: Sv2Option<'_, B016M<'a>>) -> Self

Converts to this type from the input type.
Source§

impl<'a> From<Sv2Option<'a, Inner<'a, true, 32, 0, 0>>> for EncodableField<'a>

Source§

fn from(v: Sv2Option<'_, U256<'a>>) -> Self

Converts to this type from the input type.
Source§

impl<'a> From<Sv2Option<'a, Inner<'a, true, 64, 0, 0>>> for EncodableField<'a>

Source§

fn from(v: Sv2Option<'_, Signature<'a>>) -> Self

Converts to this type from the input type.
Source§

impl<'a> From<Sv2Option<'a, U24>> for EncodableField<'a>

Source§

fn from(v: Sv2Option<'_, U24>) -> Self

Converts to this type from the input type.
Source§

impl<'a> From<Sv2Option<'a, bool>> for EncodableField<'a>

Source§

fn from(v: Sv2Option<'_, bool>) -> Self

Converts to this type from the input type.
Source§

impl<'a> From<Sv2Option<'a, u16>> for EncodableField<'a>

Source§

fn from(v: Sv2Option<'_, u16>) -> Self

Converts to this type from the input type.
Source§

impl<'a> From<Sv2Option<'a, u32>> for EncodableField<'a>

Source§

fn from(v: Sv2Option<'_, u32>) -> Self

Converts to this type from the input type.
Source§

impl<'a> From<Sv2Option<'a, u64>> for EncodableField<'a>

Source§

fn from(v: Sv2Option<'_, u64>) -> Self

Converts to this type from the input type.
Source§

impl<'a> From<Sv2Option<'a, u8>> for EncodableField<'a>

Source§

fn from(v: Sv2Option<'_, u8>) -> Self

Converts to this type from the input type.
Source§

impl<T: GetSize> GetSize for Sv2Option<'_, T>

Source§

fn get_size(&self) -> usize

get_size returns total size of the type in bytes.
Source§

impl<'a, T: PartialEq> PartialEq for Sv2Option<'a, T>

Source§

fn eq(&self, other: &Sv2Option<'a, T>) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl<'a, T: Eq> Eq for Sv2Option<'a, T>

Source§

impl<'a, T> StructuralPartialEq for Sv2Option<'a, T>

Auto Trait Implementations§

§

impl<'a, T> Freeze for Sv2Option<'a, T>

§

impl<'a, T> RefUnwindSafe for Sv2Option<'a, T>
where T: RefUnwindSafe,

§

impl<'a, T> Send for Sv2Option<'a, T>
where T: Sync + Send,

§

impl<'a, T> Sync for Sv2Option<'a, T>
where T: Sync,

§

impl<'a, T> Unpin for Sv2Option<'a, T>
where T: Unpin,

§

impl<'a, T> UnwindSafe for Sv2Option<'a, T>

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<'a, T> Encodable for T
where T: Into<EncodableField<'a>>,

Source§

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

Encodes the object into the provided byte slice. 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

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

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> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
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.