[−][src]Struct dodo::repository::RepositoryCursor
Repository cursor, yeilding all entities inside the repository.
Example
let entities = repository.find_all()? .filter(|person| person.age > 20) .skip(1) .take(3)?;
Methods
impl<'a, T, S, R> RepositoryCursor<'a, T, S, S::Iterator, R> where
T: Entity,
S: Storage,
R: Serializer,
[src]
T: Entity,
S: Storage,
R: Serializer,
pub fn shuffled(self) -> RepositoryCursor<'a, T, S, IntoIter<Result<Uuid>>, R>
[src]
Shuffles the order the entities are yielded.
Use this if you need to shuffle the entire repository contents. When done this early, this shuffles ids, not entities, so it is pretty lightweight. Nevertheless, this still has some serious performance implications, as this collects every id in the storage. With a small repository, this shouldn't be a problem, but with a large one, this will allocate a substantial amount of memory.
Examples
let mut person1 = Person::new(); let mut person2 = Person::new(); repository.insert(&mut person1)?; repository.insert(&mut person2)?; let persons : Vec<Person> = repository.find_all()? .shuffled() .collect()?; assert!(persons.contains(&person1), "Person1 should be in the results."); assert!(persons.contains(&person2), "Person2 should be in the results.");
Trait Implementations
impl<'a, T, S, I, R> Cursor for RepositoryCursor<'a, T, S, I, R> where
T: Entity,
S: Storage,
I: Iterator<Item = Result<Uuid>>,
R: Serializer,
[src]
T: Entity,
S: Storage,
I: Iterator<Item = Result<Uuid>>,
R: Serializer,
type Item = T
Entity.
fn next(&mut self) -> Result<Option<Self::Item>>
[src]
fn skip(self, nb_items: usize) -> Skip<Self> where
Self: Sized,
[src]
Self: Sized,
fn find<F>(&mut self, filter: F) -> Result<Option<Self::Item>> where
Self: Sized,
F: FnMut(&Self::Item) -> bool,
[src]
Self: Sized,
F: FnMut(&Self::Item) -> bool,
fn filter<F>(self, filter: F) -> Filter<Self, F> where
Self: Sized,
F: FnMut(&Self::Item) -> bool,
[src]
Self: Sized,
F: FnMut(&Self::Item) -> bool,
fn first(self) -> Result<Option<Self::Item>> where
Self: Sized,
[src]
Self: Sized,
fn nth(&mut self, index: usize) -> Result<Option<Self::Item>> where
Self: Sized,
[src]
Self: Sized,
fn take(self, nb_items: usize) -> Result<Vec<Self::Item>> where
Self: Sized,
[src]
Self: Sized,
fn collect(self) -> Result<Vec<Self::Item>> where
Self: Sized,
[src]
Self: Sized,
impl<'a, T: Debug, S: Debug, I: Debug, R: Debug> Debug for RepositoryCursor<'a, T, S, I, R>
[src]
Auto Trait Implementations
impl<'a, T, S, I, R> RefUnwindSafe for RepositoryCursor<'a, T, S, I, R> where
I: RefUnwindSafe,
R: RefUnwindSafe,
S: RefUnwindSafe,
T: RefUnwindSafe,
I: RefUnwindSafe,
R: RefUnwindSafe,
S: RefUnwindSafe,
T: RefUnwindSafe,
impl<'a, T, S, I, R> Send for RepositoryCursor<'a, T, S, I, R> where
I: Send,
R: Send,
S: Sync,
T: Send,
I: Send,
R: Send,
S: Sync,
T: Send,
impl<'a, T, S, I, R> Sync for RepositoryCursor<'a, T, S, I, R> where
I: Sync,
R: Sync,
S: Sync,
T: Sync,
I: Sync,
R: Sync,
S: Sync,
T: Sync,
impl<'a, T, S, I, R> Unpin for RepositoryCursor<'a, T, S, I, R> where
I: Unpin,
R: Unpin,
T: Unpin,
I: Unpin,
R: Unpin,
T: Unpin,
impl<'a, T, S, I, R> UnwindSafe for RepositoryCursor<'a, T, S, I, R> where
I: UnwindSafe,
R: UnwindSafe,
S: RefUnwindSafe,
T: UnwindSafe,
I: UnwindSafe,
R: UnwindSafe,
S: RefUnwindSafe,
T: UnwindSafe,
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
V: MultiLane<T>,