[][src]Struct juniper_eager_loading::OptionHasOne

pub struct OptionHasOne<T>(_);

An optional "has-one association".

It works exactly like HasOne except it doesn't error if the association doesn't get loaded. The value doesn't get loaded it defaults to None.

Example

You can find a complete example of OptionHasMany here.

Attributes

It supports the same attributes as HasOne.

Errors

try_unwrap will never error. If the association wasn't loaded or wasn't found it will return Ok(None).

Methods

impl<T> OptionHasOne<T>[src]

pub fn try_unwrap(&self) -> Result<&Option<T>, Error>[src]

Borrow the loaded value. If the value has not been loaded it will return Ok(None). It will not error.

Trait Implementations

impl<T> Association<T> for OptionHasOne<T>[src]

impl<T> Association<T> for OptionHasOne<Box<T>>[src]

impl<T: Clone> Clone for OptionHasOne<T>[src]

impl<T> Default for OptionHasOne<T>[src]

impl<T: Eq> Eq for OptionHasOne<T>[src]

impl<T: Ord> Ord for OptionHasOne<T>[src]

impl<T: PartialEq> PartialEq<OptionHasOne<T>> for OptionHasOne<T>[src]

impl<T: PartialOrd> PartialOrd<OptionHasOne<T>> for OptionHasOne<T>[src]

impl<T: Debug> Debug for OptionHasOne<T>[src]

impl<T> StructuralPartialEq for OptionHasOne<T>[src]

impl<T> StructuralEq for OptionHasOne<T>[src]

Auto Trait Implementations

impl<T> Send for OptionHasOne<T> where
    T: Send

impl<T> Sync for OptionHasOne<T> where
    T: Sync

impl<T> Unpin for OptionHasOne<T> where
    T: Unpin

impl<T> UnwindSafe for OptionHasOne<T> where
    T: UnwindSafe

impl<T> RefUnwindSafe for OptionHasOne<T> where
    T: RefUnwindSafe

Blanket Implementations

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

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

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<T> Borrow<T> for T where
    T: ?Sized
[src]

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

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

impl<Q, K> Equivalent<K> for Q where
    K: Borrow<Q> + ?Sized,
    Q: Eq + ?Sized
[src]