[][src]Struct bee_crypto::ternary::bigint::t242::T242

pub struct T242<T: Trit>(_);

Fixed size trit buffer.

Implementations

impl<T: Trit> T242<T>[src]

pub fn new(trits_buf: TritBuf<T1B1Buf<T>>) -> Self[src]

Creates a new fixed size trit buffer from input.

pub fn zero() -> Self[src]

Creates a new trit buffer that represents the value 0.

pub fn into_inner(self) -> TritBuf<T1B1Buf<T>>[src]

Transforms into its inner trit buffer.

impl<T> T242<T> where
    T: Trit,
    <T as ShiftTernary>::Target: Trit
[src]

pub fn into_shifted(self) -> T242<<T as ShiftTernary>::Target>[src]

Transforms into a shifted representation of the trit buffer.

impl T242<Btrit>[src]

pub fn one() -> Self[src]

Creates a new balanced trit buffer that represents the value 1.

pub fn neg_one() -> Self[src]

Creates a new balanced trit buffer that represents the value -1.

pub fn max() -> Self[src]

Creates a new balanced trit buffer that represents the maximum value.

pub fn min() -> Self[src]

Creates a new balanced trit buffer that represents the minimum value.

impl T242<Utrit>[src]

pub fn one() -> Self[src]

Creates a new unbalanced trit buffer that represents the value 1.

pub fn two() -> Self[src]

Creates a new unbalanced trit buffer that represents the value 2.

pub fn half_max() -> Self[src]

Creates a new unbalanced trit buffer that represents the half of the maximum value.

pub fn max() -> Self[src]

Creates a new unbalanced trit buffer that represents the maximum value.

pub fn min() -> Self[src]

Creates a new unbalanced trit buffer that represents the minimum value.

impl<T: Trit> T242<T>[src]

pub fn into_t243(self) -> T243<T>[src]

Converts the T242 to a T243.

impl T242<Btrit>[src]

pub fn from_i384_ignoring_mst(value: I384<BigEndian, U8Repr>) -> Self[src]

Converts a big-endian u8 represented I384 to a balanced T242 while ignoring its MST.

pub fn try_from_i384(value: I384<LittleEndian, U32Repr>) -> Result<Self, Error>[src]

Tries to convert a big-endian u32 represented I384 to a balanced T242.

impl T242<Utrit>[src]

pub fn from_u384_be_u8repr_ignoring_msd(value: U384<BigEndian, U8Repr>) -> Self[src]

Converts a big-endian u8 represented U384 to an unbalanced T242 while ignoring its MSB.

pub fn try_from_i384(value: I384<LittleEndian, U32Repr>) -> Result<Self, Error>[src]

Tries to convert a little-endian u32 represented I384 to an unbalanced T242.

Methods from Deref<Target = TritBuf<T1B1Buf<T>>>

pub fn push(
    &mut self,
    trit: <<T as RawEncodingBuf>::Slice as RawEncoding>::Trit
)
[src]

Push a trit to the back of this TritBuf.

pub fn pop(
    &mut self
) -> Option<<<T as RawEncodingBuf>::Slice as RawEncoding>::Trit>
[src]

Pop a trit from the back of this TritBuf, returning it if successful.

pub fn as_slice(&self) -> &Trits<<T as RawEncodingBuf>::Slice>[src]

Extracts a trit slice containing the data within this buffer.

Note that TritBuf dereferences to Trits anyway, so it's usually sufficient to take a reference to TritBuf or to just call &Trits methods on it rather than explicitly calling this method first.

pub fn as_slice_mut(&mut self) -> &mut Trits<<T as RawEncodingBuf>::Slice>[src]

Extracts a mutable trit slice containing the data within this buffer.

Note that TritBuf dereferences to Trits anyway, so it's usually sufficient to take a reference to TritBuf or to just call &mut Trits methods on it rather explicitly calling this method first.

pub fn pad_zeros(&mut self)[src]

Pad the trit buffer with Btrit::Zero until the buffer's length is a multiple of 3.

This method is often used in conjunction with [Trites::as_trytes].

Trait Implementations

impl<T: Clone + Trit> Clone for T242<T>[src]

impl<T: Debug + Trit> Debug for T242<T>[src]

impl<T: Trit> Default for T242<T>[src]

impl<T: Trit> Deref for T242<T>[src]

type Target = TritBuf<T1B1Buf<T>>

The resulting type after dereferencing.

impl<T: Trit> DerefMut for T242<T>[src]

impl<T: Trit> Eq for T242<T>[src]

impl From<T242<Btrit>> for I384<BigEndian, U8Repr>[src]

impl From<T242<Btrit>> for I384<BigEndian, U32Repr>[src]

impl From<T242<Btrit>> for I384<LittleEndian, U32Repr>[src]

impl<T: Trit> From<T242<T>> for T243<T>[src]

impl From<T242<Utrit>> for U384<LittleEndian, U32Repr>[src]

impl From<U384<LittleEndian, [u32; 12]>> for T242<Utrit>[src]

impl<T: Trit> Ord for T242<T>[src]

impl<T: Trit> PartialEq<T242<T>> for T242<T>[src]

impl<T: Trit> PartialOrd<T242<T>> for T242<T>[src]

impl TryFrom<I384<BigEndian, [u32; 12]>> for T242<Btrit>[src]

type Error = Error

The type returned in the event of a conversion error.

impl TryFrom<I384<BigEndian, [u8; 48]>> for T242<Btrit>[src]

type Error = Error

The type returned in the event of a conversion error.

impl TryFrom<I384<LittleEndian, [u32; 12]>> for T242<Btrit>[src]

type Error = Error

The type returned in the event of a conversion error.

impl TryFrom<I384<LittleEndian, [u8; 48]>> for T242<Btrit>[src]

type Error = Error

The type returned in the event of a conversion error.

Auto Trait Implementations

impl<T> RefUnwindSafe for T242<T> where
    T: RefUnwindSafe

impl<T> Send for T242<T> where
    T: Send

impl<T> Sync for T242<T> where
    T: Sync

impl<T> Unpin for T242<T> where
    T: Unpin

impl<T> UnwindSafe for T242<T> where
    T: UnwindSafe

Blanket Implementations

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

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

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

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

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

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

type Owned = T

The resulting type after obtaining ownership.

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.

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.