Struct awint_core::InlAwi [−][src]
pub struct InlAwi<const BW: usize, const LEN: usize> { /* fields omitted */ }
Expand description
An arbitrary width integer with const generic bitwidth that can be stored inline on the stack like an array.
NOTE: Ideally, you could just type
let _: InlAwi<100> = InlAwi<100>::zero();
if you wanted to specify and
construct an InlAwi
type with bitwidth 100. However, Rust’s lack of custom
DST support and const generics limitations makes this currently impossible.
The two const generic parameters of an InlAwi
are part of a workaround for
this. Typing out a
let _: InlAwi<BW, LEN> = InlAwi<BW, LEN>::unstable_zero()
should not be
done directly because it is non-portable and relies on unstable internal
details. Instead, you should use
let _: inlawi_ty!(100) = inlawi_zero!(100);
using macros from the
awint_macros
crate.
Implementations
impl<'a, const BW: usize, const LEN: usize> InlAwi<BW, LEN>
[src]
impl<'a, const BW: usize, const LEN: usize> InlAwi<BW, LEN>
[src]pub const fn const_as_ref(&'a self) -> &'a Bits
[src]
pub const fn const_as_ref(&'a self) -> &'a Bits
[src]Returns a reference to self
in the form of &Bits
.
pub const fn const_as_mut(&'a mut self) -> &'a mut Bits
[src]
pub const fn const_as_mut(&'a mut self) -> &'a mut Bits
[src]Returns a reference to self
in the form of &mut Bits
.
pub const fn nzbw(&self) -> NonZeroUsize
[src]
pub const fn nzbw(&self) -> NonZeroUsize
[src]Returns the bitwidth of this InlAwi
as a NonZeroUsize
Trait Implementations
impl<const BW: usize, const LEN: usize> Binary for InlAwi<BW, LEN>
[src]
impl<const BW: usize, const LEN: usize> Binary for InlAwi<BW, LEN>
[src]Forwards to the corresponding impl for Bits
impl<const BW: usize, const LEN: usize> Debug for InlAwi<BW, LEN>
[src]
impl<const BW: usize, const LEN: usize> Debug for InlAwi<BW, LEN>
[src]Forwards to the corresponding impl for Bits
impl<const BW: usize, const LEN: usize> LowerHex for InlAwi<BW, LEN>
[src]
impl<const BW: usize, const LEN: usize> LowerHex for InlAwi<BW, LEN>
[src]Forwards to the corresponding impl for Bits
impl<const BW: usize, const LEN: usize> Octal for InlAwi<BW, LEN>
[src]
impl<const BW: usize, const LEN: usize> Octal for InlAwi<BW, LEN>
[src]Forwards to the corresponding impl for Bits
impl<const BW: usize, const LEN: usize> PartialEq<InlAwi<BW, LEN>> for InlAwi<BW, LEN>
[src]
impl<const BW: usize, const LEN: usize> PartialEq<InlAwi<BW, LEN>> for InlAwi<BW, LEN>
[src]If self
and other
have unmatching bit widths, false
will be returned.
impl<const BW: usize, const LEN: usize> UpperHex for InlAwi<BW, LEN>
[src]
impl<const BW: usize, const LEN: usize> UpperHex for InlAwi<BW, LEN>
[src]Forwards to the corresponding impl for Bits
impl<const BW: usize, const LEN: usize> Copy for InlAwi<BW, LEN>
[src]
impl<const BW: usize, const LEN: usize> Eq for InlAwi<BW, LEN>
[src]
If self
and other
have unmatching bit widths, false
will be returned.
impl<const BW: usize, const LEN: usize> Send for InlAwi<BW, LEN>
[src]
InlAwi
is safe to send between threads since it does not own
aliasing memory and has no reference counting mechanism like Rc
.
impl<const BW: usize, const LEN: usize> Sync for InlAwi<BW, LEN>
[src]
InlAwi
is safe to share between threads since it does not own
aliasing memory and has no mutable internal state like Cell
or RefCell
.