pub enum HasOne<E>where
E: EntityTrait,{
Unloaded,
NotFound,
Loaded(Box<<E as EntityTrait>::ModelEx>),
}Variants§
Implementations§
Source§impl<E> HasOne<E>where
E: EntityTrait,
impl<E> HasOne<E>where
E: EntityTrait,
Sourcepub fn is_unloaded(&self) -> bool
pub fn is_unloaded(&self) -> bool
Return true if variant is Unloaded
Sourcepub fn is_not_found(&self) -> bool
pub fn is_not_found(&self) -> bool
Return true if variant is NotFound
Sourcepub fn as_ref(&self) -> Option<&<E as EntityTrait>::ModelEx>
pub fn as_ref(&self) -> Option<&<E as EntityTrait>::ModelEx>
Get a reference, if loaded
Sourcepub fn as_mut(&mut self) -> Option<&mut <E as EntityTrait>::ModelEx>
pub fn as_mut(&mut self) -> Option<&mut <E as EntityTrait>::ModelEx>
Get a mutable reference, if loaded
Sourcepub fn into_option(self) -> Option<<E as EntityTrait>::ModelEx>
pub fn into_option(self) -> Option<<E as EntityTrait>::ModelEx>
Convert into an Option<ModelEx>
Sourcepub fn take(&mut self) -> Option<<E as EntityTrait>::ModelEx>
pub fn take(&mut self) -> Option<<E as EntityTrait>::ModelEx>
Take ownership of the contained Model, leaving Unloaded in place.
Sourcepub fn unwrap(self) -> <E as EntityTrait>::ModelEx
pub fn unwrap(self) -> <E as EntityTrait>::ModelEx
§Panics
Panics if called on Unloaded or NotFound values.
Source§impl<E> HasOne<E>
impl<E> HasOne<E>
pub fn into_active_model(self) -> HasOneModel<E>
Trait Implementations§
Source§impl<E> Default for HasOne<E>where
E: EntityTrait,
impl<E> Default for HasOne<E>where
E: EntityTrait,
Source§impl<'de, E> Deserialize<'de> for HasOne<E>
Available on crate feature with-json only.
impl<'de, E> Deserialize<'de> for HasOne<E>
Available on crate feature
with-json only.Source§fn deserialize<D>(
deserializer: D,
) -> Result<HasOne<E>, <D as Deserializer<'de>>::Error>where
D: Deserializer<'de>,
fn deserialize<D>(
deserializer: D,
) -> Result<HasOne<E>, <D as Deserializer<'de>>::Error>where
D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl<E> From<Option<Box<<E as EntityTrait>::ModelEx>>> for HasOne<E>where
E: EntityTrait,
impl<E> From<Option<Box<<E as EntityTrait>::ModelEx>>> for HasOne<E>where
E: EntityTrait,
Source§impl<E> PartialEq<Option<Box<<E as EntityTrait>::ModelEx>>> for HasOne<E>
impl<E> PartialEq<Option<Box<<E as EntityTrait>::ModelEx>>> for HasOne<E>
Source§impl<E> Serialize for HasOne<E>
Available on crate feature with-json only.
impl<E> Serialize for HasOne<E>
Available on crate feature
with-json only.Source§fn serialize<S>(
&self,
serializer: S,
) -> Result<<S as Serializer>::Ok, <S as Serializer>::Error>where
S: Serializer,
fn serialize<S>(
&self,
serializer: S,
) -> Result<<S as Serializer>::Ok, <S as Serializer>::Error>where
S: Serializer,
Serialize this value into the given Serde serializer. Read more
impl<E> Eq for HasOne<E>
Auto Trait Implementations§
impl<E> Freeze for HasOne<E>
impl<E> RefUnwindSafe for HasOne<E>
impl<E> Send for HasOne<E>
impl<E> Sync for HasOne<E>
impl<E> Unpin for HasOne<E>
impl<E> UnsafeUnpin for HasOne<E>
impl<E> UnwindSafe for HasOne<E>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
Wrap the input message
T in a tonic::Request