pub struct Const { /* private fields */ }Expand description
A constant is a (possibly empty) sequence of ConstBits.
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, bit: impl Into<ConstBit>)
pub fn push(&mut self, bit: impl Into<ConstBit>)
Expands the constant by a single position with the given value.
pub fn truncate(&mut self, width: usize)
pub fn from_uint(val: u128, width: usize) -> Self
pub fn lit(value: &str) -> Self
pub fn combine( lft: impl AsRef<ConstSlice>, rgt: impl AsRef<ConstSlice>, ) -> Option<Const>
pub fn as_slice(&self) -> &ConstSlice
pub fn as_slice_mut(&mut self) -> &mut ConstSlice
Methods from Deref<Target = ConstSlice>§
pub fn len(&self) -> usize
pub fn is_empty(&self) -> bool
pub fn iter( &self, ) -> impl DoubleEndedIterator<Item = ConstBit> + ExactSizeIterator + '_
pub fn lsb(&self) -> ConstBit
pub fn msb(&self) -> ConstBit
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(&self, other: impl AsRef<ConstSlice>) -> Const
pub fn repeat(&self, count: usize) -> Const
pub fn adc(&self, other: impl AsRef<ConstSlice>, ci: ConstBit) -> Const
pub fn eq_inner(&self, other: impl AsRef<ConstSlice>) -> ConstBit
pub fn ult(&self, other: impl AsRef<ConstSlice>) -> ConstBit
pub fn slt(&self, other: impl AsRef<ConstSlice>) -> ConstBit
pub fn mul(&self, other: impl AsRef<ConstSlice>) -> Const
pub fn copy_from_slice(&mut self, other: impl AsRef<ConstSlice>)
Trait Implementations§
Source§impl AsMut<ConstSlice> for Const
impl AsMut<ConstSlice> for Const
Source§fn as_mut(&mut self) -> &mut ConstSlice
fn as_mut(&mut self) -> &mut ConstSlice
Converts this type into a mutable reference of the (usually inferred) input type.
Source§impl AsRef<ConstSlice> for Const
impl AsRef<ConstSlice> for Const
Source§fn as_ref(&self) -> &ConstSlice
fn as_ref(&self) -> &ConstSlice
Converts this type into a shared reference of the (usually inferred) input type.
Source§impl Borrow<ConstSlice> for Const
impl Borrow<ConstSlice> for Const
Source§fn borrow(&self) -> &ConstSlice
fn borrow(&self) -> &ConstSlice
Immutably borrows from an owned value. Read more
Source§impl BorrowMut<ConstSlice> for Const
impl BorrowMut<ConstSlice> for Const
Source§fn borrow_mut(&mut self) -> &mut ConstSlice
fn borrow_mut(&mut self) -> &mut ConstSlice
Mutably borrows from an owned value. Read more
impl Eq for Const
Source§impl Extend<ConstBit> for Const
impl Extend<ConstBit> for Const
Source§fn extend<T: IntoIterator<Item = ConstBit>>(&mut self, iter: T)
fn extend<T: IntoIterator<Item = ConstBit>>(&mut self, iter: T)
Extends a collection with the contents of an iterator. Read more
Source§fn extend_one(&mut self, item: T)
fn extend_one(&mut self, item: T)
🔬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<ConstBit> for Const
impl FromIterator<ConstBit> for Const
Source§impl<'a> IntoIterator for &'a Const
impl<'a> IntoIterator for &'a Const
Source§impl IntoIterator for Const
impl IntoIterator for Const
Source§impl Ord for Const
impl Ord for Const
1.21.0 (const: unstable) · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the maximum of two values. Read more
1.21.0 (const: unstable) · Source§fn min(self, other: Self) -> Selfwhere
Self: Sized,
fn min(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the minimum of two values. Read more
Source§impl PartialOrd for Const
impl PartialOrd 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 UnsafeUnpin 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.