Trait bonsaidb_core::schema::SerializedCollection
source · [−]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>, Error> { ... }
fn get<'life0, 'async_trait, C: Connection>(
id: u64,
connection: &'life0 C
) -> Pin<Box<dyn Future<Output = Result<Option<CollectionDocument<Self>>, Error>> + Send + 'async_trait>>
where
Self: Sized,
C: 'async_trait,
'life0: 'async_trait,
Self: Send + 'async_trait,
{ ... }
fn get_multiple<'life0, 'life1, 'async_trait, C: Connection>(
ids: &'life0 [u64],
connection: &'life1 C
) -> Pin<Box<dyn Future<Output = Result<Vec<CollectionDocument<Self>>, Error>> + Send + 'async_trait>>
where
Self: Sized,
C: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Self: Send + 'async_trait,
{ ... }
fn list<R: Into<Range<u64>>, C: Connection>(
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>>, Error>;
where
Self: Sized,
{ ... }
fn push<'life0, 'async_trait, Cn: Connection>(
contents: Self::Contents,
connection: &'life0 Cn
) -> Pin<Box<dyn Future<Output = Result<CollectionDocument<Self>, InsertError<Self::Contents>>> + Send + 'async_trait>>
where
Self: Sized + 'static,
Self::Contents: 'async_trait,
Cn: 'async_trait,
'life0: 'async_trait,
Self: Send + 'async_trait,
{ ... }
fn push_into<'life0, 'async_trait, Cn: Connection>(
self,
connection: &'life0 Cn
) -> Pin<Box<dyn Future<Output = Result<CollectionDocument<Self>, InsertError<Self>>> + Send + 'async_trait>>
where
Self: SerializedCollection<Contents = Self> + Sized + 'static,
Cn: 'async_trait,
'life0: 'async_trait,
Self: Send + 'async_trait,
{ ... }
fn insert<'life0, 'async_trait, Cn: Connection>(
id: u64,
contents: Self::Contents,
connection: &'life0 Cn
) -> Pin<Box<dyn Future<Output = Result<CollectionDocument<Self>, InsertError<Self::Contents>>> + Send + 'async_trait>>
where
Self: Sized + 'static,
Self::Contents: 'async_trait,
Cn: 'async_trait,
'life0: 'async_trait,
Self: Send + 'async_trait,
{ ... }
fn insert_into<'life0, 'async_trait, Cn: Connection>(
self,
id: u64,
connection: &'life0 Cn
) -> Pin<Box<dyn Future<Output = Result<CollectionDocument<Self>, InsertError<Self>>> + Send + 'async_trait>>
where
Self: SerializedCollection<Contents = Self> + Sized + 'static,
Cn: 'async_trait,
'life0: 'async_trait,
Self: Send + 'async_trait,
{ ... }
}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: Connection>(
ids: &'life0 [u64],
connection: &'life1 C
) -> Pin<Box<dyn Future<Output = Result<Vec<CollectionDocument<Self>>, Error>> + Send + 'async_trait>> where
Self: Sized,
C: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Self: Send + 'async_trait,
fn get_multiple<'life0, 'life1, 'async_trait, C: Connection>(
ids: &'life0 [u64],
connection: &'life1 C
) -> Pin<Box<dyn Future<Output = Result<Vec<CollectionDocument<Self>>, Error>> + Send + 'async_trait>> where
Self: Sized,
C: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Self: Send + 'async_trait,
Retrieves all documents matching ids. Documents that are not found
are not returned, but no error will be generated.
fn list<R: Into<Range<u64>>, C: Connection>(
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>>, Error>; where
Self: Sized,
fn list<R: Into<Range<u64>>, C: Connection>(
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>>, Error>; where
Self: Sized,
impl<'a, Cn, Cl> Future for List<'a, Cn, Cl> where
Cl: SerializedCollection + Unpin,
Cn: Connection, type Output = Result<Vec<CollectionDocument<Cl>>, 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: Connection>(
contents: Self::Contents,
connection: &'life0 Cn
) -> Pin<Box<dyn Future<Output = Result<CollectionDocument<Self>, InsertError<Self::Contents>>> + Send + 'async_trait>> where
Self: Sized + 'static,
Self::Contents: 'async_trait,
Cn: 'async_trait,
'life0: 'async_trait,
Self: Send + 'async_trait,
fn push<'life0, 'async_trait, Cn: Connection>(
contents: Self::Contents,
connection: &'life0 Cn
) -> Pin<Box<dyn Future<Output = Result<CollectionDocument<Self>, InsertError<Self::Contents>>> + Send + 'async_trait>> where
Self: Sized + 'static,
Self::Contents: 'async_trait,
Cn: 'async_trait,
'life0: 'async_trait,
Self: Send + 'async_trait,
Pushes this value into the collection, returning the created document.
fn push_into<'life0, 'async_trait, Cn: Connection>(
self,
connection: &'life0 Cn
) -> Pin<Box<dyn Future<Output = Result<CollectionDocument<Self>, InsertError<Self>>> + Send + 'async_trait>> where
Self: SerializedCollection<Contents = Self> + Sized + 'static,
Cn: 'async_trait,
'life0: 'async_trait,
Self: Send + 'async_trait,
fn push_into<'life0, 'async_trait, Cn: Connection>(
self,
connection: &'life0 Cn
) -> Pin<Box<dyn Future<Output = Result<CollectionDocument<Self>, InsertError<Self>>> + Send + 'async_trait>> where
Self: SerializedCollection<Contents = Self> + Sized + 'static,
Cn: 'async_trait,
'life0: 'async_trait,
Self: Send + 'async_trait,
Pushes this value into the collection, returning the created document.
fn insert<'life0, 'async_trait, Cn: Connection>(
id: u64,
contents: Self::Contents,
connection: &'life0 Cn
) -> Pin<Box<dyn Future<Output = Result<CollectionDocument<Self>, InsertError<Self::Contents>>> + Send + 'async_trait>> where
Self: Sized + 'static,
Self::Contents: 'async_trait,
Cn: 'async_trait,
'life0: 'async_trait,
Self: Send + 'async_trait,
fn insert<'life0, 'async_trait, Cn: Connection>(
id: u64,
contents: Self::Contents,
connection: &'life0 Cn
) -> Pin<Box<dyn Future<Output = Result<CollectionDocument<Self>, InsertError<Self::Contents>>> + Send + 'async_trait>> where
Self: Sized + 'static,
Self::Contents: 'async_trait,
Cn: 'async_trait,
'life0: 'async_trait,
Self: Send + 'async_trait,
Inserts this value into the collection with the specified id, returning the created document.
fn insert_into<'life0, 'async_trait, Cn: Connection>(
self,
id: u64,
connection: &'life0 Cn
) -> Pin<Box<dyn Future<Output = Result<CollectionDocument<Self>, InsertError<Self>>> + Send + 'async_trait>> where
Self: SerializedCollection<Contents = Self> + Sized + 'static,
Cn: 'async_trait,
'life0: 'async_trait,
Self: Send + 'async_trait,
fn insert_into<'life0, 'async_trait, Cn: Connection>(
self,
id: u64,
connection: &'life0 Cn
) -> Pin<Box<dyn Future<Output = Result<CollectionDocument<Self>, InsertError<Self>>> + Send + 'async_trait>> where
Self: SerializedCollection<Contents = Self> + Sized + 'static,
Cn: 'async_trait,
'life0: 'async_trait,
Self: Send + 'async_trait,
Inserts this value into the collection with the given id, returning
the created document.