[−][src]Struct juniper_eager_loading::OptionHasOne
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.
pub fn loaded(&mut self, inner: T)[src]
Set the given value as the loaded value.
pub fn assert_loaded_otherwise_failed(&mut self)[src]
Check that a loaded value is present otherwise set self to None.
Trait Implementations
impl<T: PartialOrd> PartialOrd<OptionHasOne<T>> for OptionHasOne<T>[src]
fn partial_cmp(&self, other: &OptionHasOne<T>) -> Option<Ordering>[src]
fn lt(&self, other: &OptionHasOne<T>) -> bool[src]
fn le(&self, other: &OptionHasOne<T>) -> bool[src]
fn gt(&self, other: &OptionHasOne<T>) -> bool[src]
fn ge(&self, other: &OptionHasOne<T>) -> bool[src]
impl<T> Default for OptionHasOne<T>[src]
impl<T: Clone> Clone for OptionHasOne<T>[src]
fn clone(&self) -> OptionHasOne<T>[src]
fn clone_from(&mut self, source: &Self)1.0.0[src]
Performs copy-assignment from source. Read more
impl<T: PartialEq> PartialEq<OptionHasOne<T>> for OptionHasOne<T>[src]
fn eq(&self, other: &OptionHasOne<T>) -> bool[src]
fn ne(&self, other: &OptionHasOne<T>) -> bool[src]
impl<T: Eq> Eq for OptionHasOne<T>[src]
impl<T: Ord> Ord for OptionHasOne<T>[src]
fn cmp(&self, other: &OptionHasOne<T>) -> Ordering[src]
fn max(self, other: Self) -> Self1.21.0[src]
Compares and returns the maximum of two values. Read more
fn min(self, other: Self) -> Self1.21.0[src]
Compares and returns the minimum of two values. Read more
fn clamp(self, min: Self, max: Self) -> Self[src]
clamp)Restrict a value to a certain interval. Read more
impl<T: Debug> Debug for OptionHasOne<T>[src]
Auto Trait Implementations
impl<T> Send for OptionHasOne<T> where
T: Send,
T: Send,
impl<T> Sync for OptionHasOne<T> where
T: Sync,
T: Sync,
Blanket Implementations
impl<T> From<T> for T[src]
impl<T> ToOwned for T where
T: Clone, [src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T[src]
fn clone_into(&self, target: &mut T)[src]
impl<T, U> Into<U> for T where
U: From<T>, [src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>, [src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>, [src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>[src]
impl<T> BorrowMut<T> for T where
T: ?Sized, [src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T[src]
impl<T> Borrow<T> for T where
T: ?Sized, [src]
T: ?Sized,
impl<T> Any for T where
T: 'static + ?Sized, [src]
T: 'static + ?Sized,