pub struct Set<T> {
pub stype: SType,
pub ascending: bool,
pub data: Vec<T>,
pub index: Vec<usize>,
}
Expand description
The struct type for sets
Fields
stype: SType
type of the set
ascending: bool
order: ascending (true), descending (false)
data: Vec<T>
data Vec
index: Vec<usize>
index Vec
Implementations
sourceimpl<T> Set<T> where
T: Copy + PartialOrd + Default,
impl<T> Set<T> where
T: Copy + PartialOrd + Default,
Associated functions for conversions and self operations returning Set
sourcepub const EMPTYSET: Set<T> = _
pub const EMPTYSET: Set<T> = _
Associated constant EMPTYSET, unique for each concrete end-type T
sourcepub fn new(set_type: SType, d: &[T], asc: bool) -> Self
pub fn new(set_type: SType, d: &[T], asc: bool) -> Self
all in one Initialiser creates a new Set of self_type, from slice d, in asc order
sourcepub fn new_unordered(d: &[T]) -> Self
pub fn new_unordered(d: &[T]) -> Self
Initialiser - creates a new SType::Unordered Set from data
sourcepub fn new_ordered(d: &[T], asc: bool) -> Self
pub fn new_ordered(d: &[T], asc: bool) -> Self
Initialiser - creates a new SType::Ordered Set in asc order from data
sourcepub fn new_indexed(d: &[T], asc: bool) -> Self
pub fn new_indexed(d: &[T], asc: bool) -> Self
Initialiser - creates a new SType::Indexed Set in asc order from data
sourcepub fn new_ranked(d: &[T], asc: bool) -> Self
pub fn new_ranked(d: &[T], asc: bool) -> Self
Initialiser - creates a new SType::Ranked Set in asc order from data
sourcepub fn to_unordered(&self) -> Self
pub fn to_unordered(&self) -> Self
Converter - to SType::Unordered Set Caution: this just throws away the valuable index!
sourcepub fn to_ordered(&self, asc: bool) -> Self
pub fn to_ordered(&self, asc: bool) -> Self
Converts any Set type to ordered
sourcepub fn to_indexed(&self, asc: bool) -> Self
pub fn to_indexed(&self, asc: bool) -> Self
Converts any Set type to indexed
sourcepub fn to_same(&self, s: &Self) -> Self
pub fn to_same(&self, s: &Self) -> Self
General converter: s -> Set of the same type and order as self self only serves as a template for the type and order and is not involved in the conversion
sourcepub fn reverse(&self) -> Self
pub fn reverse(&self) -> Self
Reverses a vec by iterating over only half of its length and swapping the items
sourcepub fn intersection(&self, s: &Self) -> Self
pub fn intersection(&self, s: &Self) -> Self
Intersection of two selfs
sourcepub fn difference(&self, s: &Self) -> Self
pub fn difference(&self, s: &Self) -> Self
Complement of s in self (i.e. self -= s)
sourcepub fn infsup(&self) -> MinMax<T> where
T: Default,
pub fn infsup(&self) -> MinMax<T> where
T: Default,
Finds minimum, minimum’s first index, maximum, maximum’s first index
Trait Implementations
sourceimpl<T> Clone for Set<T> where
T: Copy + PartialOrd + Default,
impl<T> Clone for Set<T> where
T: Copy + PartialOrd + Default,
Implementation of Clone trait for struct Set.
sourceimpl<T: Display> Display for Set<T> where
T: Copy,
impl<T: Display> Display for Set<T> where
T: Copy,
Implementation of Display trait for struct Set.
sourceimpl<T> MutSetOps<T> for Set<T> where
T: Copy + PartialOrd + Default,
impl<T> MutSetOps<T> for Set<T> where
T: Copy + PartialOrd + Default,
sourcefn munordered(&mut self)
fn munordered(&mut self)
Makes a Set unordered Caution: this just throws away the valuable index!
sourcefn msame(&mut self, s: &mut Self) where
F64: From<T>,
fn msame(&mut self, s: &mut Self) where
F64: From<T>,
General converter: s -> Set of the same type and order as self self only serves as a template for the type and order and is not involved in the conversion
sourcefn mdelete(&mut self, item: T) -> bool where
Self: Sized,
fn mdelete(&mut self, item: T) -> bool where
Self: Sized,
Deletes an item from self Returns false if item not found
sourcefn mdeleteall(&mut self, item: T) -> usize where
Self: Sized,
fn mdeleteall(&mut self, item: T) -> usize where
Self: Sized,
Deletes all occurrences of a matching item from self Returns number found and deleted
sourcefn mreverse(&mut self)
fn mreverse(&mut self)
Reverses a vec by iterating over only half of its length and swapping the items
sourcefn mnonrepeat(&mut self)
fn mnonrepeat(&mut self)
Deletes all repetitions
sourcefn mintersection(&mut self, s: &Self)
fn mintersection(&mut self, s: &Self)
Intersection of two unordered sets, assigned to self
sourcefn mdifference(&mut self, s: &Self)
fn mdifference(&mut self, s: &Self)
Complement of s in self (i.e. self -= s)
Auto Trait Implementations
impl<T> RefUnwindSafe for Set<T> where
T: RefUnwindSafe,
impl<T> Send for Set<T> where
T: Send,
impl<T> Sync for Set<T> where
T: Sync,
impl<T> Unpin for Set<T> where
T: Unpin,
impl<T> UnwindSafe for Set<T> where
T: UnwindSafe,
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> Printing<T> for T where
T: Display,
impl<T> Printing<T> for T where
T: Display,
sourcefn to_str(self) -> String
fn to_str(self) -> String
Method to serialize generic items, slices, and slices of Vecs.
Adds square brackets around Vecs (prettier lists).
Implementation code is in printing.rs
. Read more
sourcefn to_plainstr(self) -> String
fn to_plainstr(self) -> String
Method to serialize generic items, slices, and slices of Vecs.
Implementation code is in printing.rs
. Read more