Skip to main content

SmartList

Struct SmartList 

Source
pub struct SmartList<T> {
    pub data: Vec<T>,
    pub total_count: Option<u64>,
    pub aggregations: Record,
    pub summary: Record,
    pub facets: BTreeMap<String, SmartList<Record>>,
}

Fields§

§data: Vec<T>§total_count: Option<u64>§aggregations: Record§summary: Record§facets: BTreeMap<String, SmartList<Record>>

Implementations§

Source§

impl<T> SmartList<T>

Source

pub fn empty() -> Self

Source

pub fn new(data: Vec<T>) -> Self

Source

pub fn with_total_count(self, total_count: u64) -> Self

Source

pub fn with_aggregation( self, key: impl Into<String>, value: impl Into<Value>, ) -> Self

Source

pub fn with_summary( self, key: impl Into<String>, value: impl Into<Value>, ) -> Self

Source

pub fn with_facet( self, key: impl Into<String>, facet: SmartList<Record>, ) -> Self

Source

pub fn add_facet(&mut self, key: impl Into<String>, facet: SmartList<Record>)

Source

pub fn facets(&self) -> &BTreeMap<String, SmartList<Record>>

Source

pub fn facets_mut(&mut self) -> &mut BTreeMap<String, SmartList<Record>>

Source

pub fn facet(&self, key: &str) -> Option<&SmartList<Record>>

Source

pub fn facet_mut(&mut self, key: &str) -> Option<&mut SmartList<Record>>

Source

pub fn remove_facet(&mut self, key: &str) -> Option<SmartList<Record>>

Source

pub fn take_facets(&mut self) -> BTreeMap<String, SmartList<Record>>

Source

pub fn push(&mut self, value: T)

Source

pub fn extend(&mut self, values: impl IntoIterator<Item = T>)

Source

pub fn set(&mut self, index: usize, value: T) -> Option<T>

Source

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

Source

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

Source

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

Source

pub fn len(&self) -> usize

Source

pub fn is_empty(&self) -> bool

Source

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

Source

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

Source

pub fn iter_mut(&mut self) -> IterMut<'_, T>

Source

pub fn as_slice(&self) -> &[T]

Source

pub fn as_mut_slice(&mut self) -> &mut [T]

Source

pub fn retain(&mut self, filter: impl FnMut(&T) -> bool)

Source

pub fn total_count_or_len(&self) -> u64

Source

pub fn aggregation(&self, key: &str) -> Option<&Value>

Source

pub fn summary(&self, key: &str) -> Option<&Value>

Source

pub fn aggregation_json(&self) -> Value

Source

pub fn summary_json(&self) -> Value

Source

pub fn into_vec(self) -> Vec<T>

Source

pub fn map<U>(self, mapper: impl FnMut(T) -> U) -> SmartList<U>

Source

pub fn to_list<U>(&self, mapper: impl FnMut(&T) -> U) -> Vec<U>

Source

pub fn to_set<U>(&self, mapper: impl FnMut(&T) -> U) -> BTreeSet<U>
where U: Ord,

Source

pub fn identity_map<K>(&self, key: impl FnMut(&T) -> K) -> BTreeMap<K, T>
where K: Ord, T: Clone,

Source

pub fn group_by<K>(&self, key: impl FnMut(&T) -> K) -> BTreeMap<K, Vec<T>>
where K: Ord, T: Clone,

Source

pub fn merge_by<K>( &mut self, incoming: impl IntoIterator<Item = T>, key: impl FnMut(&T) -> K, )
where K: Eq + Hash,

Source

pub fn into_records(self) -> SmartList<Record>
where T: Entity,

Source§

impl<T> SmartList<T>

Source

pub fn ids(&self) -> Vec<Value>

Source

pub fn map_by_id(&self) -> BTreeMap<String, T>
where T: Clone,

Source§

impl<T> SmartList<T>
where T: VersionedEntity,

Source

pub fn versions(&self) -> Vec<i64>

Trait Implementations§

Source§

impl<T: Clone> Clone for SmartList<T>

Source§

fn clone(&self) -> SmartList<T>

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

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

Performs copy-assignment from source. Read more
Source§

impl<T: Debug> Debug for SmartList<T>

Source§

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

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

impl<T> Default for SmartList<T>

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl<T> Extend<T> for SmartList<T>

Source§

fn extend<I: IntoIterator<Item = T>>(&mut self, iter: I)

Extends a collection with the contents of an iterator. Read more
Source§

fn extend_one(&mut self, item: A)

🔬This is a nightly-only experimental API. (extend_one)
Extends a collection with exactly one element.
Source§

fn extend_reserve(&mut self, additional: usize)

🔬This is a nightly-only experimental API. (extend_one)
Reserves capacity in a collection for the given number of additional elements. Read more
Source§

impl<T> From<Vec<T>> for SmartList<T>

Source§

fn from(data: Vec<T>) -> Self

Converts to this type from the input type.
Source§

impl<T> FromIterator<T> for SmartList<T>

Source§

fn from_iter<I: IntoIterator<Item = T>>(iter: I) -> Self

Creates a value from an iterator. Read more
Source§

impl<T> Index<usize> for SmartList<T>

Source§

type Output = T

The returned type after indexing.
Source§

fn index(&self, index: usize) -> &Self::Output

Performs the indexing (container[index]) operation. Read more
Source§

impl<T> IndexMut<usize> for SmartList<T>

Source§

fn index_mut(&mut self, index: usize) -> &mut Self::Output

Performs the mutable indexing (container[index]) operation. Read more
Source§

impl<'a, T> IntoIterator for &'a SmartList<T>

Source§

type Item = &'a T

The type of the elements being iterated over.
Source§

type IntoIter = Iter<'a, T>

Which kind of iterator are we turning this into?
Source§

fn into_iter(self) -> Self::IntoIter

Creates an iterator from a value. Read more
Source§

impl<'a, T> IntoIterator for &'a mut SmartList<T>

Source§

type Item = &'a mut T

The type of the elements being iterated over.
Source§

type IntoIter = IterMut<'a, T>

Which kind of iterator are we turning this into?
Source§

fn into_iter(self) -> Self::IntoIter

Creates an iterator from a value. Read more
Source§

impl<T> IntoIterator for SmartList<T>

Source§

type Item = T

The type of the elements being iterated over.
Source§

type IntoIter = IntoIter<T>

Which kind of iterator are we turning this into?
Source§

fn into_iter(self) -> Self::IntoIter

Creates an iterator from a value. Read more
Source§

impl<T: PartialEq> PartialEq for SmartList<T>

Source§

fn eq(&self, other: &SmartList<T>) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 (const: unstable) · Source§

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

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl<T> TeaqlEmpty for SmartList<T>

Source§

impl<T> StructuralPartialEq for SmartList<T>

Auto Trait Implementations§

§

impl<T> Freeze for SmartList<T>

§

impl<T> RefUnwindSafe for SmartList<T>
where T: RefUnwindSafe,

§

impl<T> Send for SmartList<T>
where T: Send,

§

impl<T> Sync for SmartList<T>
where T: Sync,

§

impl<T> Unpin for SmartList<T>
where T: Unpin,

§

impl<T> UnsafeUnpin for SmartList<T>

§

impl<T> UnwindSafe for SmartList<T>
where T: UnwindSafe,

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§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
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,

Source§

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>,

Source§

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>,

Source§

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.