Struct libqaul::helpers::QueryResult[][src]

pub struct QueryResult<T> where
    T: FromRecord<T>, 
{ /* fields omitted */ }

The resulting set of a query operation

Implementations

impl<T> QueryResult<T> where
    T: FromRecord<T>, 
[src]

pub async fn lock(&self)[src]

Lock the garbage collection on iteratable items

By default items that are contained in this result set can be deleted by other tasks, resulting in errors when accessing data via this type. To hold the GC from running for deleted types, you can lock the set, meaning that deleted items will only be deleted when the last locked iterator goes out of scope.

This may introduce race coditions for other queries, so be aware of that!

pub fn skip(&self, num: usize)[src]

Skip a certain number of items in the result set

pub async fn next(&self) -> Result<T>[src]

Try to get a single element from the query iterator

pub async fn resolve(&self) -> Vec<T>[src]

Take all elements from the iterator and drop invalid reads

This is a semi-destructive operation because read errors will be dropped, but sometimes that is exactly what you want. Because libqaul stores messages for users separately from the “global” scope (i.e. flooded messages), a specific path query will return two paths: one will fail, the other will not.

Instead of having to filter the query results manually, this function does it internally and folds into an empty vector, meaning: if both reads fail, the resolved set will be empty.

pub async fn take(&self, num: usize) -> Result<Vec<T>>[src]

Take a number of items from the iterator to advance

If no more items are present, this function will return Err(). When less than the requested number of items are present, it will return Ok() but with all remaining items.

pub async fn all(&self) -> Result<Vec<T>>[src]

Take elements from the iterator until a read fails

Once a read fails that does’t mean that there’s no more data left, just that a read was unsuccessful. If you want to quietly drop errors, use resolve() instead!

Auto Trait Implementations

impl<T> !RefUnwindSafe for QueryResult<T>

impl<T> Send for QueryResult<T> where
    T: Send

impl<T> Sync for QueryResult<T> where
    T: Sync

impl<T> Unpin for QueryResult<T> where
    T: Unpin

impl<T> !UnwindSafe for QueryResult<T>

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T> Instrument for T[src]

impl<T> Instrument for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> Same<T> for T

type Output = T

Should always be Self

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.

impl<V, T> VZip<V> for T where
    V: MultiLane<T>, 

impl<T> WithSubscriber for T[src]