Struct skytable::query::Pipeline

source ·
pub struct Pipeline { /* private fields */ }
Expand description

§Pipeline

A pipeline can be used to send multiple queries at once to the server. Queries in a pipeline are executed independently of one another, but they are executed serially unless otherwise configured

Implementations§

source§

impl Pipeline

source

pub const fn new() -> Self

Create a new pipeline

source

pub fn query_count(&self) -> usize

Returns the number of queries that were appended to this pipeline

source

pub fn push_owned(&mut self, q: Query)

Same as Self::push, but passes ownership to the Pipeline

source

pub fn push(&mut self, q: &Query)

Add a query to this pipeline

Note: It’s not possible to get the query back from the pipeline since it’s not indexed (and doing so would be an unnecessary waste of space and time). That’s why we take a reference which allows the caller to continue owning the Query item

source

pub fn add(self, q: &Query) -> Self

Add a query to this pipeline (builder pattern)

This is intended to be used with the “builder pattern”. For example:

use skytable::{query, Pipeline};

let pipeline = Pipeline::new()
    .add(&query!("create space myspace"))
    .add(&query!("drop space myspace"));
assert_eq!(pipeline.query_count(), 2);

Trait Implementations§

source§

impl<Q: AsRef<Query>> Extend<Q> for Pipeline

source§

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

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<Q: AsRef<Query>, I> From<I> for Pipeline
where I: Iterator<Item = Q>,

source§

fn from(iter: I) -> Self

Converts to this type from the input type.
source§

impl<Q: AsRef<Query>> FromIterator<Q> for Pipeline

source§

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

Creates a value from an iterator. Read more

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

§

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.