Struct MultiFieldsULE

struct MultiFieldsULE<LEN: usize, Format: VarZeroVecFormat>(_)

This type is used by the custom derive to represent multiple VarULE fields packed into a single end-of-struct field. It is not recommended to use this type directly, use Tuple2VarULE etc instead.

Logically, consider it to be (, , , ..) where `` etc are potentially different VarULE types.

Internally, it is represented by a VarZeroSlice without the length part.

Implementations

impl<LEN: usize, Format: VarZeroVecFormat> MultiFieldsULE<LEN, Format>

fn compute_encoded_len_for(lengths: [usize; LEN]) -> usize

Compute the amount of bytes needed to support elements with lengths lengths

fn new_from_lengths_partially_initialized<'a>(lengths: [usize; LEN], output: &'a mut [u8]) -> &'a mut Self

Construct a partially initialized MultiFieldsULE backed by a mutable byte buffer

unsafe fn set_field_at<T: VarULE + ?Sized, A: EncodeAsVarULE<T> + ?Sized>(self: &mut Self, idx: usize, value: &A)

Given a buffer of size obtained by [Self::compute_encoded_len_for()], write element A to index idx

Safety

  • idx must be in range
  • T must be the appropriate type expected by the custom derive in this usage of this type
unsafe fn validate_field<T: VarULE + ?Sized>(self: &Self, index: usize) -> Result<(), UleError>

Validate field at index to see if it is a valid T VarULE type

Safety

  • index must be in range
unsafe fn get_field<T: VarULE + ?Sized>(self: &Self, index: usize) -> &T

Get field at index as a value of type T

Safety

  • index must be in range
  • Element at index must have been created with the VarULE type T
unsafe fn from_bytes_unchecked(bytes: &[u8]) -> &Self

Construct from a byte slice

Safety

  • byte slice must be a valid VarZeroLengthlessSlice<[u8], Format> with length LEN
fn as_bytes(self: &Self) -> &[u8]

Get the bytes behind this value

impl<LEN: usize, Format> Freeze for MultiFieldsULE<LEN, Format>

impl<LEN: usize, Format> RefUnwindSafe for MultiFieldsULE<LEN, Format>

impl<LEN: usize, Format> Send for MultiFieldsULE<LEN, Format>

impl<LEN: usize, Format> Sized for MultiFieldsULE<LEN, Format>

impl<LEN: usize, Format> Sync for MultiFieldsULE<LEN, Format>

impl<LEN: usize, Format> Unpin for MultiFieldsULE<LEN, Format>

impl<LEN: usize, Format> UnsafeUnpin for MultiFieldsULE<LEN, Format>

impl<LEN: usize, Format> UnwindSafe for MultiFieldsULE<LEN, Format>

impl<LEN: usize, Format: $crate::cmp::Eq + VarZeroVecFormat> Eq for MultiFieldsULE<LEN, Format>

impl<LEN: usize, Format: $crate::cmp::PartialEq + VarZeroVecFormat> PartialEq for MultiFieldsULE<LEN, Format>

fn eq(self: &Self, other: &MultiFieldsULE<LEN, Format>) -> bool

impl<LEN: usize, Format: VarZeroVecFormat> Debug for MultiFieldsULE<LEN, Format>

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

impl<LEN: usize, Format: VarZeroVecFormat> StructuralPartialEq for MultiFieldsULE<LEN, Format>

impl<LEN: usize, Format: VarZeroVecFormat> VarULE for MultiFieldsULE<LEN, Format>

fn validate_bytes(slice: &[u8]) -> Result<(), UleError>

Note: MultiFieldsULE is usually used in cases where one should be calling .validate_field() directly for each field, rather than using the regular VarULE impl.

This impl exists so that EncodeAsVarULE can work.

unsafe fn from_bytes_unchecked(bytes: &[u8]) -> &Self

impl<T> Any for MultiFieldsULE<LEN, Format>

fn type_id(self: &Self) -> TypeId

impl<T> Borrow for MultiFieldsULE<LEN, Format>

fn borrow(self: &Self) -> &T

impl<T> BorrowMut for MultiFieldsULE<LEN, Format>

fn borrow_mut(self: &mut Self) -> &mut T

impl<T> EncodeAsVarULE for MultiFieldsULE<LEN, Format>

fn encode_var_ule_as_slices<R>(self: &Self, cb: impl FnOnce(&[&[u8]]) -> R) -> R