pub trait SerializedCollection: Collection {
type Contents: Send + Sync;
type Format: OwnedDeserializer<Self::Contents>;
fn format() -> Self::Format;
fn deserialize(data: &[u8]) -> Result<Self::Contents, Error> { ... }
fn serialize(item: &Self::Contents) -> Result<Vec<u8, Global>, Error> { ... }
fn get<'life0, 'async_trait, C>(
id: u64,
connection: &'life0 C
) -> Pin<Box<dyn Future<Output = Result<Option<CollectionDocument<Self>>, Error>> + Send + 'async_trait, Global>>
where
'life0: 'async_trait,
C: Connection + 'async_trait,
Self: 'async_trait + Send,
{ ... }
fn get_multiple<'life0, 'life1, 'async_trait, C>(
ids: &'life0 [u64],
connection: &'life1 C
) -> Pin<Box<dyn Future<Output = Result<Vec<CollectionDocument<Self>, Global>, Error>> + Send + 'async_trait, Global>>
where
'life0: 'async_trait,
'life1: 'async_trait,
C: Connection + 'async_trait,
Self: 'async_trait + Send,
{ ... }
fn list<R, C>(ids: R, connection: &C) -> List<'_, C, Self>ⓘNotable traits for List<'a, Cn, Cl>impl<'a, Cn, Cl> Future for List<'a, Cn, Cl> where
Cl: SerializedCollection + Unpin,
Cn: Connection, type Output = Result<Vec<CollectionDocument<Cl>, Global>, Error>;
where
R: Into<Range<u64>>,
C: Connection,
{ ... }
fn push<'life0, 'async_trait, Cn>(
contents: Self::Contents,
connection: &'life0 Cn
) -> Pin<Box<dyn Future<Output = Result<CollectionDocument<Self>, InsertError<Self::Contents>>> + Send + 'async_trait, Global>>
where
'life0: 'async_trait,
Cn: Connection + 'async_trait,
Self: 'static + 'async_trait + Send,
Self::Contents: 'async_trait,
{ ... }
fn push_into<'life0, 'async_trait, Cn>(
self,
connection: &'life0 Cn
) -> Pin<Box<dyn Future<Output = Result<CollectionDocument<Self>, InsertError<Self>>> + Send + 'async_trait, Global>>
where
'life0: 'async_trait,
Cn: Connection + 'async_trait,
Self: 'static + SerializedCollection<Contents = Self> + 'async_trait + Send,
{ ... }
fn insert<'life0, 'async_trait, Cn>(
id: u64,
contents: Self::Contents,
connection: &'life0 Cn
) -> Pin<Box<dyn Future<Output = Result<CollectionDocument<Self>, InsertError<Self::Contents>>> + Send + 'async_trait, Global>>
where
'life0: 'async_trait,
Cn: Connection + 'async_trait,
Self: 'static + 'async_trait + Send,
Self::Contents: 'async_trait,
{ ... }
fn insert_into<'life0, 'async_trait, Cn>(
self,
id: u64,
connection: &'life0 Cn
) -> Pin<Box<dyn Future<Output = Result<CollectionDocument<Self>, InsertError<Self>>> + Send + 'async_trait, Global>>
where
'life0: 'async_trait,
Cn: Connection + 'async_trait,
Self: 'static + SerializedCollection<Contents = Self> + 'async_trait + Send,
{ ... }
}
Expand description
A collection that knows how to serialize and deserialize documents to an associated type.
Associated Types
type Format: OwnedDeserializer<Self::Contents>
type Format: OwnedDeserializer<Self::Contents>
The serialization format for this collection.
Required methods
Returns the configured instance of Self::Format
.
Provided methods
Deserialize data
as Self::Contents
using this collection’s format.
Serialize item
using this collection’s format.
Gets a CollectionDocument
with id
from connection
.
fn get_multiple<'life0, 'life1, 'async_trait, C>(
ids: &'life0 [u64],
connection: &'life1 C
) -> Pin<Box<dyn Future<Output = Result<Vec<CollectionDocument<Self>, Global>, Error>> + Send + 'async_trait, Global>> where
'life0: 'async_trait,
'life1: 'async_trait,
C: Connection + 'async_trait,
Self: 'async_trait + Send,
fn get_multiple<'life0, 'life1, 'async_trait, C>(
ids: &'life0 [u64],
connection: &'life1 C
) -> Pin<Box<dyn Future<Output = Result<Vec<CollectionDocument<Self>, Global>, Error>> + Send + 'async_trait, Global>> where
'life0: 'async_trait,
'life1: 'async_trait,
C: Connection + 'async_trait,
Self: 'async_trait + Send,
Retrieves all documents matching ids
. Documents that are not found
are not returned, but no error will be generated.
fn list<R, C>(ids: R, connection: &C) -> List<'_, C, Self>ⓘNotable traits for List<'a, Cn, Cl>impl<'a, Cn, Cl> Future for List<'a, Cn, Cl> where
Cl: SerializedCollection + Unpin,
Cn: Connection, type Output = Result<Vec<CollectionDocument<Cl>, Global>, Error>;
where
R: Into<Range<u64>>,
C: Connection,
fn list<R, C>(ids: R, connection: &C) -> List<'_, C, Self>ⓘNotable traits for List<'a, Cn, Cl>impl<'a, Cn, Cl> Future for List<'a, Cn, Cl> where
Cl: SerializedCollection + Unpin,
Cn: Connection, type Output = Result<Vec<CollectionDocument<Cl>, Global>, Error>;
where
R: Into<Range<u64>>,
C: Connection,
impl<'a, Cn, Cl> Future for List<'a, Cn, Cl> where
Cl: SerializedCollection + Unpin,
Cn: Connection, type Output = Result<Vec<CollectionDocument<Cl>, Global>, Error>;
Retrieves all documents matching ids
. Documents that are not found
are not returned, but no error will be generated.
fn push<'life0, 'async_trait, Cn>(
contents: Self::Contents,
connection: &'life0 Cn
) -> Pin<Box<dyn Future<Output = Result<CollectionDocument<Self>, InsertError<Self::Contents>>> + Send + 'async_trait, Global>> where
'life0: 'async_trait,
Cn: Connection + 'async_trait,
Self: 'static + 'async_trait + Send,
Self::Contents: 'async_trait,
fn push<'life0, 'async_trait, Cn>(
contents: Self::Contents,
connection: &'life0 Cn
) -> Pin<Box<dyn Future<Output = Result<CollectionDocument<Self>, InsertError<Self::Contents>>> + Send + 'async_trait, Global>> where
'life0: 'async_trait,
Cn: Connection + 'async_trait,
Self: 'static + 'async_trait + Send,
Self::Contents: 'async_trait,
Pushes this value into the collection, returning the created document.
fn push_into<'life0, 'async_trait, Cn>(
self,
connection: &'life0 Cn
) -> Pin<Box<dyn Future<Output = Result<CollectionDocument<Self>, InsertError<Self>>> + Send + 'async_trait, Global>> where
'life0: 'async_trait,
Cn: Connection + 'async_trait,
Self: 'static + SerializedCollection<Contents = Self> + 'async_trait + Send,
fn push_into<'life0, 'async_trait, Cn>(
self,
connection: &'life0 Cn
) -> Pin<Box<dyn Future<Output = Result<CollectionDocument<Self>, InsertError<Self>>> + Send + 'async_trait, Global>> where
'life0: 'async_trait,
Cn: Connection + 'async_trait,
Self: 'static + SerializedCollection<Contents = Self> + 'async_trait + Send,
Pushes this value into the collection, returning the created document.
fn insert<'life0, 'async_trait, Cn>(
id: u64,
contents: Self::Contents,
connection: &'life0 Cn
) -> Pin<Box<dyn Future<Output = Result<CollectionDocument<Self>, InsertError<Self::Contents>>> + Send + 'async_trait, Global>> where
'life0: 'async_trait,
Cn: Connection + 'async_trait,
Self: 'static + 'async_trait + Send,
Self::Contents: 'async_trait,
fn insert<'life0, 'async_trait, Cn>(
id: u64,
contents: Self::Contents,
connection: &'life0 Cn
) -> Pin<Box<dyn Future<Output = Result<CollectionDocument<Self>, InsertError<Self::Contents>>> + Send + 'async_trait, Global>> where
'life0: 'async_trait,
Cn: Connection + 'async_trait,
Self: 'static + 'async_trait + Send,
Self::Contents: 'async_trait,
Inserts this value into the collection with the specified id, returning the created document.
fn insert_into<'life0, 'async_trait, Cn>(
self,
id: u64,
connection: &'life0 Cn
) -> Pin<Box<dyn Future<Output = Result<CollectionDocument<Self>, InsertError<Self>>> + Send + 'async_trait, Global>> where
'life0: 'async_trait,
Cn: Connection + 'async_trait,
Self: 'static + SerializedCollection<Contents = Self> + 'async_trait + Send,
fn insert_into<'life0, 'async_trait, Cn>(
self,
id: u64,
connection: &'life0 Cn
) -> Pin<Box<dyn Future<Output = Result<CollectionDocument<Self>, InsertError<Self>>> + Send + 'async_trait, Global>> where
'life0: 'async_trait,
Cn: Connection + 'async_trait,
Self: 'static + SerializedCollection<Contents = Self> + 'async_trait + Send,
Inserts this value into the collection with the given id
, returning
the created document.