Trait bee_ternary::raw::RawEncodingBuf
source · [−]pub trait RawEncodingBuf {
type Slice: RawEncoding + ?Sized;
fn new() -> Self
where
Self: Sized;
fn with_capacity(cap: usize) -> Self
where
Self: Sized;
fn clear(&mut self);
fn push(&mut self, trit: <Self::Slice as RawEncoding>::Trit);
fn pop(&mut self) -> Option<<Self::Slice as RawEncoding>::Trit>;
fn as_slice(&self) -> &Self::Slice;
fn as_slice_mut(&mut self) -> &mut Self::Slice;
fn capacity(&self) -> usize;
fn from_trits(trits: &[<Self::Slice as RawEncoding>::Trit]) -> Self
where
Self: Sized,
{ ... }
fn into_encoding<T: RawEncodingBuf>(this: TritBuf<Self>) -> TritBuf<T>
where
Self: Sized,
T: RawEncodingBuf,
T::Slice: RawEncoding<Trit = <Self::Slice as RawEncoding>::Trit>,
{ ... }
}
Expand description
A trait to be implemented by alternative trit encoding scheme buffers.
Associated Types
type Slice: RawEncoding + ?Sized
type Slice: RawEncoding + ?Sized
The trit slice encoding associated with this trit buffer encoding.
Required methods
fn with_capacity(cap: usize) -> Self where
Self: Sized,
fn with_capacity(cap: usize) -> Self where
Self: Sized,
Create a new empty buffer with a given capacity.
Clears the buffer, removing all values. Note that this method has no effect on the allocated capacity of the buffer.
fn push(&mut self, trit: <Self::Slice as RawEncoding>::Trit)
fn push(&mut self, trit: <Self::Slice as RawEncoding>::Trit)
Push a trit to the back of this buffer.
Pop a trit from the back of this buffer.
fn as_slice_mut(&mut self) -> &mut Self::Slice
fn as_slice_mut(&mut self) -> &mut Self::Slice
View the trits in this buffer as a mutable slice.
Provided methods
fn from_trits(trits: &[<Self::Slice as RawEncoding>::Trit]) -> Self where
Self: Sized,
fn from_trits(trits: &[<Self::Slice as RawEncoding>::Trit]) -> Self where
Self: Sized,
Create a new buffer containing the given trits.
fn into_encoding<T: RawEncodingBuf>(this: TritBuf<Self>) -> TritBuf<T> where
Self: Sized,
T: RawEncodingBuf,
T::Slice: RawEncoding<Trit = <Self::Slice as RawEncoding>::Trit>,
fn into_encoding<T: RawEncodingBuf>(this: TritBuf<Self>) -> TritBuf<T> where
Self: Sized,
T: RawEncodingBuf,
T::Slice: RawEncoding<Trit = <Self::Slice as RawEncoding>::Trit>,
Convert this encoding into another encoding.
TODO: Rename this reencode