Query

Enum Query 

Source
pub enum Query<V, E> {
    Get(Path, RespondOne<V, ()>),
    GetTree(Path, RespondMany<V, ()>),
    GetRange((Bound<Path>, Bound<Path>), RespondMany<V, ()>),
    GetAll(RespondMany<V, ()>),
    Upsert(Path, RespondOne<V, E>),
    Insert(RespondMany<V, Keyed<E>>),
}
Expand description

A query to the KV store.

Type parameter V is the value type of the KV store. (The key type is Path.) The parameter E is type for events that can update a value. In other words, the inner state machine at each Path receives events type E and manages state type V.

The functions of type RespondOne and RespondMany are passed the query result. Results contain borrowed values &V which can’t be passed to channels or other data structures. The respond function may clone these to pass them on, or the function may interpret or aggregate borrowed values in place.

Variants§

§

Get(Path, RespondOne<V, ()>)

Get the value at the given path, or None.

§

GetTree(Path, RespondMany<V, ()>)

Get the entries whose path starts with the given path, including the entry for the path itself.

§

GetRange((Bound<Path>, Bound<Path>), RespondMany<V, ()>)

Get the entries in the given range

§

GetAll(RespondMany<V, ()>)

Get all the entries

§

Upsert(Path, RespondOne<V, E>)

Get the value at the given path or None and emit an event for that path.

§

Insert(RespondMany<V, Keyed<E>>)

Get all the entries and emit an event for a particular (usually new) path.

Auto Trait Implementations§

§

impl<V, E> Freeze for Query<V, E>

§

impl<V, E> !RefUnwindSafe for Query<V, E>

§

impl<V, E> Send for Query<V, E>

§

impl<V, E> !Sync for Query<V, E>

§

impl<V, E> Unpin for Query<V, E>

§

impl<V, E> !UnwindSafe for Query<V, E>

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