pub struct ShortlexUnsignedVectorRef<'a, T: PrimitiveUnsigned>(pub &'a UnsignedVector<T>);Expand description
ShortlexUnsignedVectorRef is a wrapper around an UnsignedVector, taking the
UnsignedVector by reference.
See the ShortlexUnsignedVector documentation for details.
Tuple Fields§
§0: &'a UnsignedVector<T>Trait Implementations§
Source§impl<'a, T: Clone + PrimitiveUnsigned> Clone for ShortlexUnsignedVectorRef<'a, T>
impl<'a, T: Clone + PrimitiveUnsigned> Clone for ShortlexUnsignedVectorRef<'a, T>
Source§impl<T: PrimitiveUnsigned> Debug for ShortlexUnsignedVectorRef<'_, T>
impl<T: PrimitiveUnsigned> Debug for ShortlexUnsignedVectorRef<'_, T>
Source§fn fmt(&self, f: &mut Formatter<'_>) -> Result
fn fmt(&self, f: &mut Formatter<'_>) -> Result
Writes a ShortlexUnsignedVectorRef as ShortlexUnsignedVectorRef( followed by the
vector and ).
§Examples
use core::str::FromStr;
use malachite_base::strings::ToDebugString;
use malachite_base::unsigned_vector::{ShortlexUnsignedVectorRef, UnsignedVector};
let v = UnsignedVector::<u32>::from_str("(1, 2)").unwrap();
assert_eq!(
ShortlexUnsignedVectorRef(&v).to_debug_string(),
"ShortlexUnsignedVectorRef((1, 2))"
);Source§impl<T: PrimitiveUnsigned> Deref for ShortlexUnsignedVectorRef<'_, T>
impl<T: PrimitiveUnsigned> Deref for ShortlexUnsignedVectorRef<'_, T>
Source§fn deref(&self) -> &UnsignedVector<T>
fn deref(&self) -> &UnsignedVector<T>
Allows a ShortlexUnsignedVectorRef to dereference to an UnsignedVector.
use core::str::FromStr;
use malachite_base::unsigned_vector::{ShortlexUnsignedVectorRef, UnsignedVector};
let v = UnsignedVector::<u32>::from_str("(1, 2, 3)").unwrap();
let x = ShortlexUnsignedVectorRef(&v);
assert_eq!(*x, v);Source§type Target = UnsignedVector<T>
type Target = UnsignedVector<T>
impl<'a, T: Eq + PrimitiveUnsigned> Eq for ShortlexUnsignedVectorRef<'a, T>
Source§impl<'a, T: Hash + PrimitiveUnsigned> Hash for ShortlexUnsignedVectorRef<'a, T>
impl<'a, T: Hash + PrimitiveUnsigned> Hash for ShortlexUnsignedVectorRef<'a, T>
Source§impl<T: PrimitiveUnsigned> Ord for ShortlexUnsignedVectorRef<'_, T>
impl<T: PrimitiveUnsigned> Ord for ShortlexUnsignedVectorRef<'_, T>
Source§fn cmp(&self, other: &Self) -> Ordering
fn cmp(&self, other: &Self) -> Ordering
Compares two ShortlexUnsignedVectorRefs.
The order is shortlex: the vectors are compared first by dimension, and then, in case of a
tie, lexicographically, by their elements from first to last. The 0-dimensional vector comes
first. This is a total order, and its equality agrees with
UnsignedVector equality.
Where the dimensions differ this parts company with the lexicographic order of Vecs:
here dimension decides outright, so $(5) < (0, 0)$, where lexicographic order has $(5) > (0,
0)$.
§Examples
use core::str::FromStr;
use malachite_base::unsigned_vector::{ShortlexUnsignedVectorRef, UnsignedVector};
let empty = UnsignedVector::<u32>::from_str("()").unwrap();
let five = UnsignedVector::<u32>::from_str("(5)").unwrap();
let zero_zero = UnsignedVector::<u32>::from_str("(0, 0)").unwrap();
let zero_one = UnsignedVector::<u32>::from_str("(0, 1)").unwrap();
// The 0-dimensional vector comes first.
assert!(ShortlexUnsignedVectorRef(&empty) < ShortlexUnsignedVectorRef(&five));
// Dimension decides, whatever the elements.
assert!(ShortlexUnsignedVectorRef(&five) < ShortlexUnsignedVectorRef(&zero_zero));
// At equal dimensions, the first differing element decides.
assert!(ShortlexUnsignedVectorRef(&zero_zero) < ShortlexUnsignedVectorRef(&zero_one));1.21.0 (const: unstable) · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
1.21.0 (const: unstable) · Source§fn min(self, other: Self) -> Selfwhere
Self: Sized,
fn min(self, other: Self) -> Selfwhere
Self: Sized,
Source§impl<'a, T: PartialEq + PrimitiveUnsigned> PartialEq for ShortlexUnsignedVectorRef<'a, T>
impl<'a, T: PartialEq + PrimitiveUnsigned> PartialEq for ShortlexUnsignedVectorRef<'a, T>
Source§impl<T: PrimitiveUnsigned> PartialOrd for ShortlexUnsignedVectorRef<'_, T>
impl<T: PrimitiveUnsigned> PartialOrd for ShortlexUnsignedVectorRef<'_, T>
Source§fn partial_cmp(&self, other: &Self) -> Option<Ordering>
fn partial_cmp(&self, other: &Self) -> Option<Ordering>
Compares two ShortlexUnsignedVectorRefs.
See the documentation for the Ord implementation.
impl<'a, T: PartialEq + PrimitiveUnsigned> StructuralPartialEq for ShortlexUnsignedVectorRef<'a, T>
Auto Trait Implementations§
impl<'a, T> Freeze for ShortlexUnsignedVectorRef<'a, T>where
<T as BalancedModPowerOf2>::Output: Sized,
<T as BalancedMod>::Output: Sized,
&'a UnsignedVector<T>: Freeze,
impl<'a, T> RefUnwindSafe for ShortlexUnsignedVectorRef<'a, T>where
<T as BalancedModPowerOf2>::Output: Sized,
<T as BalancedMod>::Output: Sized,
&'a UnsignedVector<T>: RefUnwindSafe,
impl<'a, T> Send for ShortlexUnsignedVectorRef<'a, T>where
<T as BalancedModPowerOf2>::Output: Sized,
<T as BalancedMod>::Output: Sized,
&'a UnsignedVector<T>: Send,
impl<'a, T> Sync for ShortlexUnsignedVectorRef<'a, T>where
<T as BalancedModPowerOf2>::Output: Sized,
<T as BalancedMod>::Output: Sized,
&'a UnsignedVector<T>: Sync,
impl<'a, T> Unpin for ShortlexUnsignedVectorRef<'a, T>where
<T as BalancedModPowerOf2>::Output: Sized,
<T as BalancedMod>::Output: Sized,
&'a UnsignedVector<T>: Unpin,
impl<'a, T> UnsafeUnpin for ShortlexUnsignedVectorRef<'a, T>where
<T as BalancedModPowerOf2>::Output: Sized,
<T as BalancedMod>::Output: Sized,
&'a UnsignedVector<T>: UnsafeUnpin,
impl<'a, T> UnwindSafe for ShortlexUnsignedVectorRef<'a, T>where
<T as BalancedModPowerOf2>::Output: Sized,
<T as BalancedMod>::Output: Sized,
&'a UnsignedVector<T>: UnwindSafe,
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<T, U> ImaginaryInto<U> for Twhere
U: ImaginaryFrom<T>,
impl<T, U> ImaginaryInto<U> for Twhere
U: ImaginaryFrom<T>,
fn imaginary_into(self) -> U
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more