pub trait DatabaseEntry:
Serialize
+ DeserializeOwned
+ for<'de> Deserialize<'de>
+ Clone
+ Debug
+ 'static {
type Id: EntryId<Entry = Self>;
const VERSION_NUMBER: u32;
// Required methods
fn id(&self) -> Self::Id;
fn tree(db: &Db) -> Tree;
// Provided methods
fn db_check(id: Self::Id) -> Result<bool> { ... }
fn db_check_version(id: Self::Id) -> Result<Option<u32>, DatabaseError> { ... }
fn db_create(args: <Self as Createable>::CreateArgs) -> Result<Self>
where Self: Createable { ... }
fn db_get(id: Self::Id) -> Result<Option<Self>> { ... }
fn db_get_all() -> Result<Vec<Self>> { ... }
fn db_get_batch<I, A>(ids: I) -> Result<Vec<Self>>
where I: IntoIterator<Item = A>,
A: Borrow<Self::Id> { ... }
fn db_merge(&self, into: Self::Id) -> Result<()>
where Self: Mergeable { ... }
fn db_patch(&mut self) -> Result<()>
where Self: Patchable<Self> { ... }
fn pre_upsert(
&mut self,
_cas_tx: &CompareAndSwapTransaction,
) -> Result<(), DatabaseError> { ... }
fn db_upsert(&self) -> Result<()> { ... }
}Required Associated Constants§
Sourceconst VERSION_NUMBER: u32
const VERSION_NUMBER: u32
The current version number of the struct, used for updating
Required Associated Types§
Required Methods§
Provided Methods§
fn db_check_version(id: Self::Id) -> Result<Option<u32>, DatabaseError>
Sourcefn db_create(args: <Self as Createable>::CreateArgs) -> Result<Self>where
Self: Createable,
fn db_create(args: <Self as Createable>::CreateArgs) -> Result<Self>where
Self: Createable,
Creates a new Self in the database using Self::CreateArgs
Sourcefn db_get_all() -> Result<Vec<Self>>
fn db_get_all() -> Result<Vec<Self>>
Sourcefn db_get_batch<I, A>(ids: I) -> Result<Vec<Self>>
fn db_get_batch<I, A>(ids: I) -> Result<Vec<Self>>
Sourcefn db_merge(&self, into: Self::Id) -> Result<()>where
Self: Mergeable,
fn db_merge(&self, into: Self::Id) -> Result<()>where
Self: Mergeable,
Merges self into into in the database.
All items that point to self will be relinked to into and self will be deleted from the database
Sourcefn db_patch(&mut self) -> Result<()>where
Self: Patchable<Self>,
fn db_patch(&mut self) -> Result<()>where
Self: Patchable<Self>,
Patches or inserts Self into the database
Patching rules depend on how Self implements Patchable<Self>
fn pre_upsert( &mut self, _cas_tx: &CompareAndSwapTransaction, ) -> Result<(), DatabaseError>
fn db_upsert(&self) -> Result<()>
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.