[−][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.
Trait Implementations
impl<T> Association<T> for OptionHasOne<T>
[src]
fn loaded_child(&mut self, child: T)
[src]
fn assert_loaded_otherwise_failed(&mut self)
[src]
impl<T> Association<T> for OptionHasOne<Box<T>>
[src]
fn loaded_child(&mut self, child: T)
[src]
fn assert_loaded_otherwise_failed(&mut self)
[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]
impl<T: Debug> Debug 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]
fn cmp(&self, other: &OptionHasOne<T>) -> Ordering
[src]
#[must_use]
fn max(self, other: Self) -> Self
1.21.0[src]
#[must_use]
fn min(self, other: Self) -> Self
1.21.0[src]
#[must_use]
fn clamp(self, min: Self, max: Self) -> Self
[src]
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: 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> StructuralEq for OptionHasOne<T>
[src]
impl<T> StructuralPartialEq for OptionHasOne<T>
[src]
Auto Trait Implementations
impl<T> RefUnwindSafe for OptionHasOne<T> where
T: RefUnwindSafe,
T: RefUnwindSafe,
impl<T> Send for OptionHasOne<T> where
T: Send,
T: Send,
impl<T> Sync for OptionHasOne<T> where
T: Sync,
T: Sync,
impl<T> Unpin for OptionHasOne<T> where
T: Unpin,
T: Unpin,
impl<T> UnwindSafe for OptionHasOne<T> where
T: UnwindSafe,
T: UnwindSafe,
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<Q, K> Equivalent<K> for Q where
K: Borrow<Q> + ?Sized,
Q: Eq + ?Sized,
[src]
K: Borrow<Q> + ?Sized,
Q: Eq + ?Sized,
fn equivalent(&self, key: &K) -> bool
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
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> 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>,