[][src]Struct structsy::StructsyQueryTx

pub struct StructsyQueryTx<'a, T: Persistent + 'static> { /* fields omitted */ }

Query for a persistent struct considering in transaction changes.

Example

use structsy::{ Structsy, StructsyTx, StructsyError};
use structsy_derive::{queries, Persistent};
#[derive(Persistent)]
struct Basic {
    name: String,
}
impl Basic {
    fn new(name: &str) -> Basic {
        Basic { name: name.to_string() }
    }
}

#[queries(Basic)]
trait BasicQuery {
    fn by_name(self, name: String) -> Self;
}


fn basic_query() -> Result<(), StructsyError> {
    let structsy = Structsy::open("file.structsy")?;
    structsy.define::<Basic>()?;
    let mut tx = structsy.begin()?;
    tx.insert(&Basic::new("aaa"))?;
    let count = tx.query::<Basic>().by_name("aaa".to_string()).into_iter().count();
    assert_eq!(count, 1);
    tx.commit()?;
    Ok(())
}

Trait Implementations

impl<'a, T: Persistent> IntoIterator for StructsyQueryTx<'a, T>[src]

type Item = (Ref<T>, T)

The type of the elements being iterated over.

type IntoIter = StructsyIter<'a, T>

Which kind of iterator are we turning this into?

impl<'a, T: Persistent + 'static> Query<T> for StructsyQueryTx<'a, T>[src]

Auto Trait Implementations

impl<'a, T> !RefUnwindSafe for StructsyQueryTx<'a, T>

impl<'a, T> !Send for StructsyQueryTx<'a, T>

impl<'a, T> !Sync for StructsyQueryTx<'a, T>

impl<'a, T> Unpin for StructsyQueryTx<'a, T>

impl<'a, T> !UnwindSafe for StructsyQueryTx<'a, 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, U> Into<U> for T where
    U: From<T>, 
[src]

impl<I> IntoIterator for I where
    I: Iterator
[src]

type Item = <I as Iterator>::Item

The type of the elements being iterated over.

type IntoIter = I

Which kind of iterator are we turning this into?

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