Struct sets::Set

source ·
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

Associated functions for conversions and self operations returning Set = Self

Associated constant EMPTYSET, unique for each concrete end-type T

all in one Initialiser creates a new Set of self_type, from slice d, in asc order

Creates a new empty Set

Initialiser - creates a new SType::Unordered Set from data

Initialiser - creates a new SType::Ordered Set in asc order from data

Initialiser - creates a new SType::Indexed Set in asc order from data

Initialiser - creates a new SType::Ranked Set in asc order from data

Converter - to SType::Unordered Set Caution: this just throws away the valuable index!

Converts any Set type to ordered

Converts any Set type to indexed

Converts any Set type to ranked

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

Inserts an item of the same end-type to self

Deletes an item of the same end-type from self

Reverses a vec by iterating over only half of its length and swapping the items

Deletes any repetitions

Union of two selfs

Intersection of two selfs

Complement of s in self (i.e. self -= s)

Finds minimum, minimum’s first index, maximum, maximum’s first index

Search a Set self for m. Returns the subscript of the first m or None

True if m is a member of the self Throws away the subscript found by search

Trait Implementations

Returns a copy of the value. Read more
Performs copy-assignment from source. Read more
Returns the “default value” for a type. Read more

Implementation of Display trait for struct Set.

Formats the value using the given formatter. Read more

Makes a Set unordered Caution: this just throws away the valuable index!

Makes a Set ordered

Makes any Set indexed

Converts any Set type to ranked

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

Deletes an item from self Returns false if item not found

Deletes all occurrences of a matching item from self Returns number found and deleted

Inserts an item v of the same end-type to self

Reverses a vec by iterating over only half of its length and swapping the items

Deletes all repetitions

sets union

Intersection of two unordered sets, assigned to self

Complement of s in self (i.e. self -= s)

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

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
Method to serialize generic items, slices, and slices of Vecs. Implementation code is in printing.rs. Read more
Printable in red
Printable in green
Printable in blue
Printable in yellow
Printable in magenta
Printable in cyan
Method to write vector(s) to file f (space separated, without brackets). Passes up io errors Read more
Method to print vector(s) to stdout (space separated,without brackets).
The resulting type after obtaining ownership.
Creates owned data from borrowed data, usually by cloning. Read more
Uses borrowed data to replace owned data, usually by cloning. Read more
Converts the given value to a String. Read more
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.