Module partial_ord

Module partial_ord 

Source
Expand description

New functions for &(mut) dyn [PartialOrd].

DynSlice(Mut)<dyn PartialOrd<Rhs>> implements PartialOrd<[Rhs]>. Slices are compared lexicographically.

§Example

let array: [u8; 4] = [1, 2, 4, 8];
let slice = partial_ord::new(&array);

assert!(slice > &[1, 2, 3, 4][..]);
assert!(slice == &array[..]);
assert!(slice < &[1, 2, 4, 8, 16][..]);

Functions§

new
Create a dyn slice from a slice of a type that implements PartialOrd.
new_mut
Create a mutable dyn slice from a mutable slice of a type that implements PartialOrd.

Type Aliases§

Dyn
An alias for dyn PartialOrd.
Slice
An alias for &dyn [PartialOrd] (DynSlice<Dyn>).
SliceMut
An alias for &mut dyn [PartialOrd] (DynSliceMut<Dyn>).