#[repr(packed)]
pub struct OptionVarULE<U: VarULE + ?Sized>(_, _, _);
Expand description

A type allowing one to represent Option<U> for VarULE U types.

use zerovec::ule::OptionVarULE;
use zerovec::VarZeroVec;

let mut zv: VarZeroVec<OptionVarULE<str>> = VarZeroVec::new();

zv.make_mut().push(&None::<&str>);
zv.make_mut().push(&Some("hello"));
zv.make_mut().push(&Some("world"));
zv.make_mut().push(&None::<&str>);

assert_eq!(zv.get(0).unwrap().as_ref(), None);
assert_eq!(zv.get(1).unwrap().as_ref(), Some("hello"));

Implementations

Obtain this as an Option<&U>

Trait Implementations

Calls cb with a piecewise list of byte slices that when concatenated produce the memory pattern of the corresponding instance of T. Read more

Return the length, in bytes, of the corresponding VarULE type

Write the corresponding VarULE type to the dst buffer. dst should be the size of Self::encode_var_ule_len() Read more

This method returns an Ordering between self and other. Read more

Compares and returns the maximum of two values. Read more

Compares and returns the minimum of two values. Read more

Restrict a value to a certain interval. Read more

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

This method returns an ordering between self and other values if one exists. Read more

This method tests less than (for self and other) and is used by the < operator. Read more

This method tests less than or equal to (for self and other) and is used by the <= operator. Read more

This method tests greater than (for self and other) and is used by the > operator. Read more

This method tests greater than or equal to (for self and other) and is used by the >= operator. Read more

Validates a byte slice, &[u8]. Read more

Takes a byte slice, &[u8], and return it as &Self with the same lifetime, assuming that this byte slice has previously been run through Self::parse_byte_slice() with success. Read more

Parses a byte slice, &[u8], and return it as &Self with the same lifetime. Read more

Given &Self, returns a &[u8] with the same lifetime. Read more

Allocate on the heap as a Box<T>

The container that can be used with this type: ZeroVec or VarZeroVec.

The type produced by Container::get() Read more

The type produced by Container::replace() and Container::remove(), also used during deserialization. If Self is human readable serialized, deserializing to Self::OwnedType should produce the same value once passed through Self::owned_as_self() Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more