Struct crypto::hashes::ternary::kerl::bigint::t243::BTRIT_0[][src]

pub struct BTRIT_0 { /* fields omitted */ }
👎 Deprecated
This is supported on crate features ternary_hashes and kerl_deprecated_do_not_use only.

T243 balanced trits represented 0.

Methods from Deref<Target = T243<Btrit>>

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 append<U>(&mut self, trits: &Trits<U>) where
    U: RawEncoding<Trit = <<T as RawEncodingBuf>::Slice as RawEncoding>::Trit> + ?Sized
[src]

Append a trit slice to the end of this TritBuf.

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].

Methods from Deref<Target = Trits<<T as RawEncodingBuf>::Slice>>

pub fn is_empty(&self) -> bool[src]

Returns true if the trit slice is empty.

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

Returns the number of trits in this trit slice.

pub fn as_i8_slice(&self) -> &[i8][src]

Interpret this slice as an (std::i8) slice.

Panics

This function will panic if the slice is not byte-aligned.

pub unsafe fn as_i8_slice_mut(&mut self) -> &mut [i8][src]

Interpret this slice as a mutable (std::i8) slice.

Panics

This function will panic if the slice is not byte-aligned.

Safety

This function is marked unsafe because modification of the trit slice in a manner that is not valid for this encoding is undefined behaviour.

pub unsafe fn get_unchecked(&self, index: usize) -> <T as RawEncoding>::Trit[src]

Fetch the trit at the given index of this trit slice without first checking whether the index is in bounds. Providing an index that is not less than the length of this slice is undefined behaviour.

This is perhaps the ‘least bad’ unsafe function in this crate: not because any form of undefined behaviour is better or worse than another (after all, the point of undefined behaviour is that it is undefined) but because it’s the easiest to use correctly.

Safety

An index with a value less then the result of Trits::len must be used. Any other value is undefined behaviour.

pub unsafe fn set_unchecked(
    &mut self,
    index: usize,
    trit: <T as RawEncoding>::Trit
)
[src]

Set the trit at the given index of this trit slice without first checking whether the index is in bounds. Providing an index that is not less than the length of this slice is undefined behaviour.

This is perhaps the ‘least bad’ unsafe function in this crate: not because any form of undefined behaviour is better or worse than another (after all, the point of undefined behaviour is that it is undefined) but because it’s the easiest to use correctly.

Safety

An index with a value less then the result of Trits::len must be used. Any other value is undefined behaviour.

pub fn get(&self, index: usize) -> Option<<T as RawEncoding>::Trit>[src]

Fetch the trit at the given index of this trit slice, if the index is valid.

pub fn set(&mut self, index: usize, trit: <T as RawEncoding>::Trit)[src]

Set the trit at the given index of this mutable trit slice, if the index is valid.

Panics

This function will panic if the index is not less than the length of this slice.

pub fn iter(&self) -> impl DoubleEndedIterator + ExactSizeIterator[src]

Returns an iterator over the trits in this slice.

Using this function is significantly faster than calling Trits::get in a loop and should be used where possible.

pub fn subslice(&self, range: Range<usize>) -> &Trits<T>[src]

Returns a subslice of this slice with the given range of trits.

Panics

This function will panic if called with a range that contains indices outside this slice, or the start of the range is greater than its end.

pub fn subslice_mut(&mut self, range: Range<usize>) -> &mut Trits<T>[src]

Returns a mutable subslice of this mutable slice with the given range of trits.

Panics

This function will panic if called with a range that contains indices outside this slice, or the start of the range is greater than its end.

pub fn copy_from<U>(&mut self, trits: &Trits<U>) where
    U: RawEncoding<Trit = <T as RawEncoding>::Trit> + ?Sized
[src]

Copy the trits from a trit slice into this mutable trit slice (the encoding need not be equivalent).

Panics

This function will panic if the length of the slices are different.

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

Fill this mutable trit slice with copied of the given trit.

pub fn to_buf<U>(&self) -> TritBuf<U> where
    U: RawEncodingBuf<Slice = T>, 
[src]

Copy the contents of this trit slice into a new TritBuf with the same encoding. This function is analogous to to_vec method implemented on ordinary slices.

pub fn chunks(
    &self,
    chunk_len: usize
) -> impl DoubleEndedIterator + ExactSizeIterator
[src]

Return an iterator over distinct, non-overlapping subslices of this trit slice, each with the given chunk length. If the length of the trit slice is not a multiple of the given chunk length, the last slice provided by the iterator will be smaller to compensate.

Panics

This function will panic if the given chunk length is 0.

pub fn encode<U>(&self) -> TritBuf<U> where
    U: RawEncodingBuf,
    <U as RawEncodingBuf>::Slice: RawEncoding,
    <<U as RawEncodingBuf>::Slice as RawEncoding>::Trit == <T as RawEncoding>::Trit
[src]

Encode the contents of this trit slice into a TritBuf with a different encoding.

pub fn iter_trytes(&self) -> impl DoubleEndedIterator + ExactSizeIterator[src]

Returns an iterator over the trytes represented within this slice.

For encodings that are representation-compatible with trytes, such as T3B1, use Trits::as_trytes instead since it is faster and more capable.

pub fn negate(&mut self)[src]

Negate each trit in this buffer.

This has the effect of making the trit buffer negative when expressed in numeric form.

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

View this trit slice as an ordinary slice of trits.

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

View this mutable trit slice as an ordinary slice of mutable trits.

pub fn chunks_mut(
    &mut self,
    chunk_len: usize
) -> impl Iterator<Item = &mut Trits<T1B1<T>>>
[src]

Return an iterator over distinct, non-overlapping mutable subslices of this mutable trit slice, each with the given chunk length. If the length of the trit slice is not a multiple of the given chunk length, the last slice provided by the iterator will be smaller to compensate.

Panics

This function will panic if the given chunk length is 0.

pub fn iter_mut(&mut self) -> IterMut<'_, T>[src]

Returns a mutable iterator over the trits in this slice.

Using this function is significantly faster than calling Trits::set in a loop and should be used where possible.

pub fn as_trytes(&self) -> &[Tryte][src]

Interpret this trit slice as a Tryte slice.

Panics

This function will panic if the length of the slice is not a multiple of 3, or if the slice is not byte-aligned.

pub fn as_trytes_mut(&mut self) -> &mut [Tryte][src]

Interpret this mutable trit slice as a mutable Tryte slice.

Panics

This function will panic if the length of the slice is not a multiple of 3, or if the slice is not byte-aligned.

Trait Implementations

impl Deref for BTRIT_0[src]

type Target = T243<Btrit>

The resulting type after dereferencing.

impl LazyStatic for BTRIT_0[src]

Auto Trait Implementations

impl RefUnwindSafe for BTRIT_0

impl Send for BTRIT_0

impl Sync for BTRIT_0

impl Unpin for BTRIT_0

impl UnwindSafe for BTRIT_0

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> Same<T> for T

type Output = T

Should always be Self

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.