Struct sqlite3_parser::ast::DistinctNames

source ·
pub struct DistinctNames(/* private fields */);
Expand description

Ordered set of distinct column names

Implementations§

source§

impl DistinctNames

source

pub fn new(name: Name) -> DistinctNames

Initialize

source

pub fn single(name: Name) -> DistinctNames

Single column name

source

pub fn insert(&mut self, name: Name) -> Result<(), ParserError>

Push a distinct name or fail

Methods from Deref<Target = IndexSet<Name>>§

source

pub fn capacity(&self) -> usize

Return the number of elements the set can hold without reallocating.

This number is a lower bound; the set might be able to hold more, but is guaranteed to be able to hold at least this many.

Computes in O(1) time.

source

pub fn hasher(&self) -> &S

Return a reference to the set’s BuildHasher.

source

pub fn len(&self) -> usize

Return the number of elements in the set.

Computes in O(1) time.

source

pub fn is_empty(&self) -> bool

Returns true if the set contains no elements.

Computes in O(1) time.

source

pub fn iter(&self) -> Iter<'_, T>

Return an iterator over the values of the set, in their order

source

pub fn difference<'a, S2>( &'a self, other: &'a IndexSet<T, S2>, ) -> Difference<'a, T, S2>
where S2: BuildHasher,

Return an iterator over the values that are in self but not other.

Values are produced in the same order that they appear in self.

source

pub fn symmetric_difference<'a, S2>( &'a self, other: &'a IndexSet<T, S2>, ) -> SymmetricDifference<'a, T, S, S2>
where S2: BuildHasher,

Return an iterator over the values that are in self or other, but not in both.

Values from self are produced in their original order, followed by values from other in their original order.

source

pub fn intersection<'a, S2>( &'a self, other: &'a IndexSet<T, S2>, ) -> Intersection<'a, T, S2>
where S2: BuildHasher,

Return an iterator over the values that are in both self and other.

Values are produced in the same order that they appear in self.

source

pub fn union<'a, S2>(&'a self, other: &'a IndexSet<T, S2>) -> Union<'a, T, S>
where S2: BuildHasher,

Return an iterator over all values that are in self or other.

Values from self are produced in their original order, followed by values that are unique to other in their original order.

source

pub fn contains<Q>(&self, value: &Q) -> bool
where Q: Hash + Equivalent<T> + ?Sized,

Return true if an equivalent to value exists in the set.

Computes in O(1) time (average).

source

pub fn get<Q>(&self, value: &Q) -> Option<&T>
where Q: Hash + Equivalent<T> + ?Sized,

Return a reference to the value stored in the set, if it is present, else None.

Computes in O(1) time (average).

source

pub fn get_full<Q>(&self, value: &Q) -> Option<(usize, &T)>
where Q: Hash + Equivalent<T> + ?Sized,

Return item index and value

source

pub fn get_index_of<Q>(&self, value: &Q) -> Option<usize>
where Q: Hash + Equivalent<T> + ?Sized,

Return item index, if it exists in the set

Computes in O(1) time (average).

Search over a sorted set for a value.

Returns the position where that value is present, or the position where it can be inserted to maintain the sort. See slice::binary_search for more details.

Computes in O(log(n)) time, which is notably less scalable than looking the value up using get_index_of, but this can also position missing values.

source

pub fn binary_search_by<'a, F>(&'a self, f: F) -> Result<usize, usize>
where F: FnMut(&'a T) -> Ordering,

Search over a sorted set with a comparator function.

Returns the position where that value is present, or the position where it can be inserted to maintain the sort. See slice::binary_search_by for more details.

Computes in O(log(n)) time.

source

pub fn binary_search_by_key<'a, B, F>( &'a self, b: &B, f: F, ) -> Result<usize, usize>
where F: FnMut(&'a T) -> B, B: Ord,

Search over a sorted set with an extraction function.

Returns the position where that value is present, or the position where it can be inserted to maintain the sort. See slice::binary_search_by_key for more details.

Computes in O(log(n)) time.

source

pub fn partition_point<P>(&self, pred: P) -> usize
where P: FnMut(&T) -> bool,

Returns the index of the partition point of a sorted set according to the given predicate (the index of the first element of the second partition).

See slice::partition_point for more details.

Computes in O(log(n)) time.

source

pub fn as_slice(&self) -> &Slice<T>

Returns a slice of all the values in the set.

Computes in O(1) time.

source

pub fn get_index(&self, index: usize) -> Option<&T>

Get a value by index

Valid indices are 0 <= index < self.len()

Computes in O(1) time.

source

pub fn get_range<R>(&self, range: R) -> Option<&Slice<T>>
where R: RangeBounds<usize>,

Returns a slice of values in the given range of indices.

Valid indices are 0 <= index < self.len()

Computes in O(1) time.

source

pub fn first(&self) -> Option<&T>

Get the first value

Computes in O(1) time.

source

pub fn last(&self) -> Option<&T>

Get the last value

Computes in O(1) time.

source

pub fn is_disjoint<S2>(&self, other: &IndexSet<T, S2>) -> bool
where S2: BuildHasher,

Returns true if self has no elements in common with other.

source

pub fn is_subset<S2>(&self, other: &IndexSet<T, S2>) -> bool
where S2: BuildHasher,

Returns true if all elements of self are contained in other.

source

pub fn is_superset<S2>(&self, other: &IndexSet<T, S2>) -> bool
where S2: BuildHasher,

Returns true if all elements of other are contained in self.

Trait Implementations§

source§

impl Clone for DistinctNames

source§

fn clone(&self) -> DistinctNames

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Debug for DistinctNames

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl Deref for DistinctNames

§

type Target = IndexSet<Name>

The resulting type after dereferencing.
source§

fn deref(&self) -> &IndexSet<Name>

Dereferences the value.
source§

impl PartialEq for DistinctNames

source§

fn eq(&self, other: &DistinctNames) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl Eq for DistinctNames

source§

impl StructuralPartialEq for DistinctNames

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> CloneToUninit for T
where T: Clone,

source§

default unsafe fn clone_to_uninit(&self, dst: *mut T)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dst. Read more
source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

source§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

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

source§

impl<T> ToOwned for T
where T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.