Struct bee_message::prelude::PaddedIndex[][src]

pub struct PaddedIndex(_);
Expand description

An indexation payload index padded with 0 up to the maximum length.

Implementations

impl PaddedIndex[src]

pub fn new(bytes: [u8; 64]) -> Self[src]

Creates a new PaddedIndex.

Methods from Deref<Target = [u8; 64]>

pub fn as_slice(&self) -> &[T]

Notable traits for &'_ [u8]

impl<'_> Read for &'_ [u8]impl<'_> Write for &'_ mut [u8]
[src]

🔬 This is a nightly-only experimental API. (array_methods)

Returns a slice containing the entire array. Equivalent to &s[..].

pub fn each_ref(&self) -> [&T; N][src]

🔬 This is a nightly-only experimental API. (array_methods)

Borrows each element and returns an array of references with the same size as self.

Example

#![feature(array_methods)]

let floats = [3.1, 2.7, -1.0];
let float_refs: [&f64; 3] = floats.each_ref();
assert_eq!(float_refs, [&3.1, &2.7, &-1.0]);

This method is particularly useful if combined with other methods, like map. This way, you can avoid moving the original array if its elements are not Copy.

#![feature(array_methods, array_map)]

let strings = ["Ferris".to_string(), "♥".to_string(), "Rust".to_string()];
let is_ascii = strings.each_ref().map(|s| s.is_ascii());
assert_eq!(is_ascii, [true, false, true]);

// We can still access the original array: it has not been moved.
assert_eq!(strings.len(), 3);

Trait Implementations

impl AsRef<[u8]> for PaddedIndex[src]

fn as_ref(&self) -> &[u8]

Notable traits for &'_ [u8]

impl<'_> Read for &'_ [u8]impl<'_> Write for &'_ mut [u8]
[src]

Performs the conversion.

impl Clone for PaddedIndex[src]

fn clone(&self) -> PaddedIndex[src]

Returns a copy of the value. Read more

fn clone_from(&mut self, source: &Self)1.0.0[src]

Performs copy-assignment from source. Read more

impl Debug for PaddedIndex[src]

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

Formats the value using the given formatter. Read more

impl Deref for PaddedIndex[src]

type Target = [u8; 64]

The resulting type after dereferencing.

fn deref(&self) -> &Self::Target[src]

Dereferences the value.

impl Display for PaddedIndex[src]

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

Formats the value using the given formatter. Read more

impl From<[u8; 64]> for PaddedIndex[src]

fn from(bytes: [u8; 64]) -> Self[src]

Performs the conversion.

impl Hash for PaddedIndex[src]

fn hash<__H: Hasher>(&self, state: &mut __H)[src]

Feeds this value into the given Hasher. Read more

fn hash_slice<H>(data: &[Self], state: &mut H) where
    H: Hasher
1.3.0[src]

Feeds a slice of this type into the given Hasher. Read more

impl PartialEq<PaddedIndex> for PaddedIndex[src]

fn eq(&self, other: &PaddedIndex) -> bool[src]

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

fn ne(&self, other: &PaddedIndex) -> bool[src]

This method tests for !=.

impl Copy for PaddedIndex[src]

impl Eq for PaddedIndex[src]

impl StructuralEq for PaddedIndex[src]

impl StructuralPartialEq for PaddedIndex[src]

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

pub fn type_id(&self) -> TypeId[src]

Gets the TypeId of self. Read more

impl<T> Base32Len for T where
    T: AsRef<[u8]>, 
[src]

pub fn base32_len(&self) -> usize[src]

Calculate the base32 serialized length

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

pub fn borrow(&self) -> &T[src]

Immutably borrows from an owned value. Read more

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

pub fn borrow_mut(&mut self) -> &mut T[src]

Mutably borrows from an owned value. Read more

impl<'f, T> CheckBase32<Vec<u5, Global>> for T where
    T: AsRef<[u8]>, 
[src]

type Err = Error

Error type if conversion fails

pub fn check_base32(
    self
) -> Result<Vec<u5, Global>, <T as CheckBase32<Vec<u5, Global>>>::Err>
[src]

Check if all values are in range and return array-like struct of u5 values

impl<T> From<T> for T[src]

pub fn from(t: T) -> T[src]

Performs the conversion.

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

pub fn into(self) -> U[src]

Performs the conversion.

impl<T> Same<T> for T

type Output = T

Should always be Self

impl<T> ToBase32 for T where
    T: AsRef<[u8]>, 
[src]

pub fn write_base32<W>(
    &self,
    writer: &mut W
) -> Result<(), <W as WriteBase32>::Err> where
    W: WriteBase32
[src]

Encode as base32 and write it to the supplied writer Implementations shouldn’t allocate. Read more

fn to_base32(&self) -> Vec<u5, Global>[src]

Convert Self to base32 vector

impl<T> ToHex for T where
    T: AsRef<[u8]>, 
[src]

pub fn encode_hex<U>(&self) -> U where
    U: FromIterator<char>, 
[src]

Encode the hex strict representing self into the result. Lower case letters are used (e.g. f9b4ca) Read more

pub fn encode_hex_upper<U>(&self) -> U where
    U: FromIterator<char>, 
[src]

Encode the hex strict representing self into the result. Upper case letters are used (e.g. F9B4CA) Read more

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

pub fn to_owned(&self) -> T[src]

Creates owned data from borrowed data, usually by cloning. Read more

pub fn clone_into(&self, target: &mut T)[src]

🔬 This is a nightly-only experimental API. (toowned_clone_into)

recently added

Uses borrowed data to replace owned data, usually by cloning. Read more

impl<T> ToString for T where
    T: Display + ?Sized
[src]

pub default fn to_string(&self) -> String[src]

Converts the given value to a String. Read more

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>[src]

Performs the conversion.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

pub fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>[src]

Performs the conversion.