Struct arithmetic_typing::TupleLen
source · pub struct TupleLen { /* private fields */ }
Expand description
Generic tuple length.
A tuple length consists of the two components: an unknown / variable length,
such as UnknownLen::Var
, and a non-negative increment.
These components can be obtained via Self::components()
.
§Static lengths
Tuple lengths can be either static or dynamic. Dynamic lengths are lengths
that contain UnknownLen::Dynamic
.
Functions, TypeArithmetic
s, etc. can specify constraints on lengths being static.
For example, this is a part of Ops
;
dynamically sized slices such as [Num]
cannot be added / multiplied / etc.,
even if they are of the same type. This constraint is denoted as len! N, M, ...
in the function quantifier, e.g., for<len! N> (['T; N]) -> 'T
.
If the constraint fails, an error will be raised with the kind
set to ErrorKind::DynamicLen
.
Implementations§
source§impl TupleLen
impl TupleLen
sourcepub fn components(&self) -> (Option<UnknownLen>, usize)
pub fn components(&self) -> (Option<UnknownLen>, usize)
Returns components of this length.
sourcepub fn components_mut(&mut self) -> (Option<&mut UnknownLen>, &mut usize)
pub fn components_mut(&mut self) -> (Option<&mut UnknownLen>, &mut usize)
Returns mutable references to the components of this length.
Trait Implementations§
source§impl From<UnknownLen> for TupleLen
impl From<UnknownLen> for TupleLen
source§fn from(var: UnknownLen) -> Self
fn from(var: UnknownLen) -> Self
source§impl PartialEq for TupleLen
impl PartialEq for TupleLen
impl Copy for TupleLen
impl Eq for TupleLen
impl StructuralPartialEq for TupleLen
Auto Trait Implementations§
impl Freeze for TupleLen
impl RefUnwindSafe for TupleLen
impl Send for TupleLen
impl Sync for TupleLen
impl Unpin for TupleLen
impl UnwindSafe for TupleLen
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
source§impl<T> CloneToUninit for Twhere
T: Copy,
impl<T> CloneToUninit for Twhere
T: Copy,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§default unsafe fn clone_to_uninit(&self, dst: *mut T)
default unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)