pub struct Const { /* private fields */ }
Expand description
A constant is a (possibly empty) sequence of Trit
s.
Implementations§
Source§impl Const
impl Const
Sourcepub fn one_hot(width: usize, hot_at: usize) -> Self
pub fn one_hot(width: usize, hot_at: usize) -> Self
Creates a constant of given width that has a 1
at position hot_at
and 0
elsewhere.
Sourcepub fn push(&mut self, trit: impl Into<Trit>)
pub fn push(&mut self, trit: impl Into<Trit>)
Expands the constant by a single position with the given value.
pub fn from_uint(val: u128, bits: usize) -> Self
pub fn lit(value: &str) -> Self
pub fn len(&self) -> usize
pub fn is_empty(&self) -> bool
pub fn iter( &self, ) -> impl DoubleEndedIterator<Item = Trit> + ExactSizeIterator + '_
pub fn lsb(&self) -> Trit
pub fn msb(&self) -> Trit
pub fn is_zero(&self) -> bool
pub fn is_ones(&self) -> bool
pub fn is_undef(&self) -> bool
pub fn has_undef(&self) -> bool
pub fn as_power_of_two(&self) -> Option<u32>
pub fn concat<'a>(&self, other: impl Into<Cow<'a, Const>>) -> Self
pub fn repeat(&self, count: usize) -> Self
pub fn slice(&self, range: impl RangeBounds<usize>) -> Const
pub fn combine<'a, 'b>( lft: impl Into<Cow<'a, Const>>, rgt: impl Into<Cow<'b, Const>>, ) -> Option<Const>
pub fn not(&self) -> Const
pub fn and<'a>(&self, other: impl Into<Cow<'a, Const>>) -> Const
pub fn or<'a>(&self, other: impl Into<Cow<'a, Const>>) -> Const
pub fn xor<'a>(&self, other: impl Into<Cow<'a, Const>>) -> Const
pub fn adc<'a>(&self, other: impl Into<Cow<'a, Const>>, ci: Trit) -> Const
pub fn eq<'a>(&self, other: impl Into<Cow<'a, Const>>) -> Trit
pub fn ult<'a>(&self, other: impl Into<Cow<'a, Const>>) -> Trit
pub fn slt<'a>(&self, other: impl Into<Cow<'a, Const>>) -> Trit
pub fn mul<'a>(&self, other: impl Into<Cow<'a, Const>>) -> Const
Trait Implementations§
Source§impl Extend<Trit> for Const
impl Extend<Trit> for Const
Source§fn extend<T: IntoIterator<Item = Trit>>(&mut self, iter: T)
fn extend<T: IntoIterator<Item = Trit>>(&mut self, iter: T)
Extends a collection with the contents of an iterator. Read more
Source§fn extend_one(&mut self, item: A)
fn extend_one(&mut self, item: A)
🔬This is a nightly-only experimental API. (
extend_one
)Extends a collection with exactly one element.
Source§fn extend_reserve(&mut self, additional: usize)
fn extend_reserve(&mut self, additional: usize)
🔬This is a nightly-only experimental API. (
extend_one
)Reserves capacity in a collection for the given number of additional elements. Read more
Source§impl From<&Const> for ParamValue
impl From<&Const> for ParamValue
Source§impl From<Const> for ParamValue
impl From<Const> for ParamValue
Source§impl FromIterator<Trit> for Const
impl FromIterator<Trit> for Const
Source§impl IntoIterator for &Const
impl IntoIterator for &Const
Source§impl IntoIterator for Const
impl IntoIterator for Const
Source§impl Ord for Const
impl Ord for Const
Source§impl PartialOrd for Const
impl PartialOrd for Const
impl Eq for Const
impl StructuralPartialEq for Const
Auto Trait Implementations§
impl Freeze for Const
impl RefUnwindSafe for Const
impl Send for Const
impl Sync for Const
impl Unpin for Const
impl UnwindSafe for Const
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<Q, K> Comparable<K> for Q
impl<Q, K> Comparable<K> for Q
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Checks if this value is equivalent to the given key. Read more
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key
and return true
if they are equal.