[−][src]Struct bee_crypto::ternary::bigint::t242::T242
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]
T: Trit,
<T as ShiftTernary>::Target: Trit,
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]
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]
&mut self,
trit: <<T as RawEncodingBuf>::Slice as RawEncoding>::Trit
)
Push a trit to the back of this TritBuf
.
pub fn pop(
&mut self
) -> Option<<<T as RawEncodingBuf>::Slice as RawEncoding>::Trit>
[src]
&mut self
) -> Option<<<T as RawEncodingBuf>::Slice as RawEncoding>::Trit>
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]
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.
fn deref(&self) -> &Self::Target
[src]
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]
fn from(binary_value: U384<LittleEndian, U32Repr>) -> Self
[src]
impl<T: Trit> Ord for T242<T>
[src]
fn cmp(&self, other: &Self) -> Ordering
[src]
#[must_use]fn max(self, other: Self) -> Self
1.21.0[src]
#[must_use]fn min(self, other: Self) -> Self
1.21.0[src]
#[must_use]fn clamp(self, min: Self, max: Self) -> Self
[src]
impl<T: Trit> PartialEq<T242<T>> for T242<T>
[src]
impl<T: Trit> PartialOrd<T242<T>> for T242<T>
[src]
fn partial_cmp(&self, other: &Self) -> Option<Ordering>
[src]
#[must_use]fn lt(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]fn le(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]fn gt(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]fn ge(&self, other: &Rhs) -> bool
1.0.0[src]
impl TryFrom<I384<BigEndian, [u32; 12]>> for T242<Btrit>
[src]
type Error = Error
The type returned in the event of a conversion error.
fn try_from(value: I384<BigEndian, U32Repr>) -> Result<Self, Self::Error>
[src]
impl TryFrom<I384<BigEndian, [u8; 48]>> for T242<Btrit>
[src]
type Error = Error
The type returned in the event of a conversion error.
fn try_from(value: I384<BigEndian, U8Repr>) -> Result<Self, Self::Error>
[src]
impl TryFrom<I384<LittleEndian, [u32; 12]>> for T242<Btrit>
[src]
type Error = Error
The type returned in the event of a conversion error.
fn try_from(value: I384<LittleEndian, U32Repr>) -> Result<Self, Self::Error>
[src]
impl TryFrom<I384<LittleEndian, [u8; 48]>> for T242<Btrit>
[src]
Auto Trait Implementations
impl<T> RefUnwindSafe for T242<T> where
T: RefUnwindSafe,
T: RefUnwindSafe,
impl<T> Send for T242<T> where
T: Send,
T: Send,
impl<T> Sync for T242<T> where
T: Sync,
T: Sync,
impl<T> Unpin for T242<T> where
T: Unpin,
T: Unpin,
impl<T> UnwindSafe for T242<T> where
T: UnwindSafe,
T: UnwindSafe,
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,