Skip to main content

CustomPersistor

Struct CustomPersistor 

Source
pub struct CustomPersistor<V: Serialize + DeserializeOwned, S, D: ?Sized, IO: PersistorIO<S>, Ser: Fn(&V) -> Result<S>, De: Fn(&D) -> Result<V>> {
    pub ser: Ser,
    pub de: De,
    pub id: String,
    pub scope: Scope,
    pub suffix: Option<String>,
    /* private fields */
}

Fields§

§ser: Ser§de: De§id: String§scope: Scope§suffix: Option<String>

Implementations§

Source§

impl<V, S, D, IO, Ser, De> CustomPersistor<V, S, D, IO, Ser, De>
where V: Serialize + DeserializeOwned, D: ?Sized, IO: PersistorIO<S>, Ser: Fn(&V) -> Result<S>, De: Fn(&D) -> Result<V>, S: AsRef<D>,

Source

pub fn new( ser: Ser, de: De, id: String, scope: Scope, suffix: Option<String>, ) -> Self

Trait Implementations§

Source§

impl<V, S, D, IO, Ser, De> Persistor<V> for CustomPersistor<V, S, D, IO, Ser, De>
where V: VersionControlled + Serialize + DeserializeOwned, D: ?Sized, IO: PersistorIO<S>, Ser: Fn(&V) -> Result<S>, De: Fn(&D) -> Result<V>, S: AsRef<D>,

Source§

async fn load(&self) -> Result<Option<V>>

Source§

async fn save(&self, value: &V) -> Result<()>

Auto Trait Implementations§

§

impl<V, S, D, IO, Ser, De> !Send for CustomPersistor<V, S, D, IO, Ser, De>

§

impl<V, S, D, IO, Ser, De> !Sync for CustomPersistor<V, S, D, IO, Ser, De>

§

impl<V, S, D, IO, Ser, De> Freeze for CustomPersistor<V, S, D, IO, Ser, De>
where Ser: Freeze, De: Freeze, PhantomData<(IO, V, S, *const D)>: Freeze, D: ?Sized,

§

impl<V, S, D, IO, Ser, De> RefUnwindSafe for CustomPersistor<V, S, D, IO, Ser, De>
where Ser: RefUnwindSafe, De: RefUnwindSafe, PhantomData<(IO, V, S, *const D)>: RefUnwindSafe, D: ?Sized,

§

impl<V, S, D, IO, Ser, De> Unpin for CustomPersistor<V, S, D, IO, Ser, De>
where Ser: Unpin, De: Unpin, PhantomData<(IO, V, S, *const D)>: Unpin, D: ?Sized,

§

impl<V, S, D, IO, Ser, De> UnsafeUnpin for CustomPersistor<V, S, D, IO, Ser, De>
where Ser: UnsafeUnpin, De: UnsafeUnpin, PhantomData<(IO, V, S, *const D)>: UnsafeUnpin, D: ?Sized,

§

impl<V, S, D, IO, Ser, De> UnwindSafe for CustomPersistor<V, S, D, IO, Ser, De>
where Ser: UnwindSafe, De: UnwindSafe, PhantomData<(IO, V, S, *const D)>: UnwindSafe, D: ?Sized,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.