pub struct Entry<'a, 'name, Connection, Col, EI, EU>{ /* private fields */ }
Expand description
A future that resolves to an entry in a NamedCollection
.
Implementations§
source§impl<'a, 'name, Connection, Col, EI, EU> Entry<'a, 'name, Connection, Col, EI, EU>where
'name: 'a,
Col: NamedCollection + SerializedCollection + 'static + Unpin,
Connection: Connection,
EI: EntryInsert<Col> + 'a + Unpin,
EU: EntryUpdate<Col> + 'a + Unpin,
impl<'a, 'name, Connection, Col, EI, EU> Entry<'a, 'name, Connection, Col, EI, EU>where
'name: 'a,
Col: NamedCollection + SerializedCollection + 'static + Unpin,
Connection: Connection,
EI: EntryInsert<Col> + 'a + Unpin,
EU: EntryUpdate<Col> + 'a + Unpin,
sourcepub fn execute(self) -> Result<Option<CollectionDocument<Col>>, Error>
pub fn execute(self) -> Result<Option<CollectionDocument<Col>>, Error>
Retrieves the document, if found/inserted.
sourcepub fn or_insert_with<F>(
self,
cb: F
) -> Entry<'a, 'name, Connection, Col, F, EU>where
F: EntryInsert<Col> + 'a + Unpin,
pub fn or_insert_with<F>(
self,
cb: F
) -> Entry<'a, 'name, Connection, Col, F, EU>where
F: EntryInsert<Col> + 'a + Unpin,
If an entry with the key doesn’t exist, cb
will be executed to provide
an initial document. This document will be saved before being returned.
sourcepub fn update_with<F>(self, cb: F) -> Entry<'a, 'name, Connection, Col, EI, F>where
F: EntryUpdate<Col> + 'a + Unpin,
pub fn update_with<F>(self, cb: F) -> Entry<'a, 'name, Connection, Col, EI, F>where
F: EntryUpdate<Col> + 'a + Unpin,
If an entry with the keys exists, cb
will be executed with the stored
value, allowing an opportunity to update the value. This new value will
be saved to the database before returning. If an error occurs during
update, cb
may be invoked multiple times, up to the
retry_limit
.
sourcepub const fn retry_limit(
self,
attempts: usize
) -> Entry<'a, 'name, Connection, Col, EI, EU>
pub const fn retry_limit( self, attempts: usize ) -> Entry<'a, 'name, Connection, Col, EI, EU>
The number of attempts to attempt updating the document using
update_with
before returning an error.
Auto Trait Implementations§
impl<'a, 'name, Connection, Col, EI, EU> RefUnwindSafe for Entry<'a, 'name, Connection, Col, EI, EU>where
Col: RefUnwindSafe,
Connection: RefUnwindSafe,
EI: RefUnwindSafe,
EU: RefUnwindSafe,
<Col as Collection>::PrimaryKey: RefUnwindSafe,
impl<'a, 'name, Connection, Col, EI, EU> Send for Entry<'a, 'name, Connection, Col, EI, EU>where
Connection: Sync,
impl<'a, 'name, Connection, Col, EI, EU> Sync for Entry<'a, 'name, Connection, Col, EI, EU>
impl<'a, 'name, Connection, Col, EI, EU> Unpin for Entry<'a, 'name, Connection, Col, EI, EU>
impl<'a, 'name, Connection, Col, EI, EU> UnwindSafe for Entry<'a, 'name, Connection, Col, EI, EU>where
Col: UnwindSafe,
Connection: RefUnwindSafe,
EI: UnwindSafe,
EU: UnwindSafe,
<Col as Collection>::PrimaryKey: UnwindSafe,
Blanket Implementations§
§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more