pub trait Storing:
Serialize
+ for<'de> Deserialize<'de>
+ Default {
// Provided method
fn store_type() -> StoringType { ... }
}Expand description
Trait allowing a struct to be managed by Storage.
The Storing trait provides a way to specify the type of storage location for a struct.
It requires the struct to implement Serialize, Deserialize, and Default traits.
§Example
use rusty_store::{Storage, StoreHandle, Storing, StoringType};
use serde::{Deserialize, Serialize};
#[derive(Serialize, Deserialize, Default)]
struct MyStore {
pub count: u32,
}
impl Storing for MyStore {
fn store_type() -> StoringType {
StoringType::Data
}
}Provided Methods§
fn store_type() -> StoringType
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.