Trait bonsaidb_core::schema::view::SerializedView
source · pub trait SerializedView: View {
type Format: OwnedDeserializer<Self::Value>;
// Required method
fn format() -> Self::Format;
// Provided methods
fn deserialize(data: &[u8]) -> Result<Self::Value, Error> { ... }
fn serialize(item: &Self::Value) -> Result<Vec<u8>, Error> { ... }
fn entries<Database: Connection>(
database: &Database
) -> View<'_, Database, Self, Self::Key> { ... }
fn entries_async<Database: AsyncConnection>(
database: &Database
) -> AsyncView<'_, Database, Self, Self::Key> { ... }
}
Expand description
A View
with additional tyes and logic to handle serializing view values.
Required Associated Types§
Required Methods§
sourcefn format() -> Self::Format
fn format() -> Self::Format
Returns the configured instance of Self::Format
.
Provided Methods§
sourcefn deserialize(data: &[u8]) -> Result<Self::Value, Error>
fn deserialize(data: &[u8]) -> Result<Self::Value, Error>
Deserialize data
as Self::Value
using this views’s format.
sourcefn serialize(item: &Self::Value) -> Result<Vec<u8>, Error>
fn serialize(item: &Self::Value) -> Result<Vec<u8>, Error>
Serialize item
using this views’s format.
sourcefn entries<Database: Connection>(
database: &Database
) -> View<'_, Database, Self, Self::Key>
fn entries<Database: Connection>( database: &Database ) -> View<'_, Database, Self, Self::Key>
Returns a builder for a view query or view reduce.
sourcefn entries_async<Database: AsyncConnection>(
database: &Database
) -> AsyncView<'_, Database, Self, Self::Key>
fn entries_async<Database: AsyncConnection>( database: &Database ) -> AsyncView<'_, Database, Self, Self::Key>
Returns a builder for a view query or view reduce.