Struct ate::dio::DaoRef[][src]

pub struct DaoRef<D> where
    D: Serialize + DeserializeOwned + Clone + Send + Sync
{ /* fields omitted */ }

Rerepresents a reference to another data object with strong type linting to make the model more solidified

Implementations

impl<D> DaoRef<D> where
    D: Serialize + DeserializeOwned + Clone + Send + Sync
[src]

pub fn new() -> DaoRef<D>[src]

pub fn get_id(&self) -> Option<PrimaryKey>[src]

pub fn set_id(&mut self, val: PrimaryKey)[src]

pub fn clear(&mut self)[src]

pub async fn load<'a>(
    &self,
    dio: &mut Dio<'a>
) -> Result<Option<Dao<D>>, LoadError> where
    D: Serialize + DeserializeOwned + Clone + Send + Sync
[src]

Loads the data object (if it exists)

pub async fn store<'a>(
    &mut self,
    dio: &mut Dio<'a>,
    value: D
) -> Result<Dao<D>, LoadError>
[src]

Stores the data within this reference

pub async fn unwrap_or<'a>(
    &mut self,
    dio: &mut Dio<'a>,
    default: D
) -> Result<Dao<D>, LoadError> where
    D: Serialize + DeserializeOwned + Clone + Send + Sync
[src]

Loads the data object or uses a default if none exists

pub async fn unwrap_or_else<'a, F: FnOnce() -> D>(
    &mut self,
    dio: &mut Dio<'a>,
    f: F
) -> Result<Dao<D>, LoadError> where
    D: Serialize + DeserializeOwned + Clone + Send + Sync
[src]

Loads the data object or uses a default if none exists

pub async fn unwrap_or_default<'a>(
    &mut self,
    dio: &mut Dio<'a>
) -> Result<Dao<D>, LoadError> where
    D: Default + Serialize + DeserializeOwned + Clone + Send + Sync
[src]

Loads the data object or creates a new one (if it does not exist)

pub async fn expect<'a>(&mut self, dio: &mut Dio<'a>, msg: &str) -> Dao<D> where
    D: Serialize + DeserializeOwned + Clone + Send + Sync
[src]

pub async fn unwrap<'a>(&mut self, dio: &mut Dio<'a>) -> Dao<D>[src]

pub async fn take<'a>(
    &mut self,
    dio: &mut Dio<'a>
) -> Result<Option<Dao<D>>, LoadError>
[src]

pub async fn replace<'a>(
    &mut self,
    dio: &mut Dio<'a>,
    value: D
) -> Result<Option<Dao<D>>, LoadError>
[src]

pub fn is_some(&self) -> bool[src]

pub fn is_none(&self) -> bool[src]

Trait Implementations

impl<D: Clone> Clone for DaoRef<D> where
    D: Serialize + DeserializeOwned + Clone + Send + Sync
[src]

impl<D: Debug> Debug for DaoRef<D> where
    D: Serialize + DeserializeOwned + Clone + Send + Sync
[src]

impl<D> Default for DaoRef<D> where
    D: Serialize + DeserializeOwned + Clone + Send + Sync
[src]

impl<'de, D> Deserialize<'de> for DaoRef<D> where
    D: Serialize + DeserializeOwned + Clone + Send + Sync
[src]

impl<D> From<PrimaryKey> for DaoRef<D> where
    D: Serialize + DeserializeOwned + Clone + Send + Sync
[src]

impl<D> Serialize for DaoRef<D> where
    D: Serialize + DeserializeOwned + Clone + Send + Sync
[src]

Auto Trait Implementations

impl<D> RefUnwindSafe for DaoRef<D> where
    D: RefUnwindSafe

impl<D> Send for DaoRef<D>

impl<D> Sync for DaoRef<D>

impl<D> Unpin for DaoRef<D> where
    D: Unpin

impl<D> UnwindSafe for DaoRef<D> where
    D: UnwindSafe

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> DeserializeOwned for T where
    T: for<'de> Deserialize<'de>, 
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> Same<T> for T

type Output = T

Should always be Self

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.

impl<V, T> VZip<V> for T where
    V: MultiLane<T>,