pub enum Join<E>where
E: Keyed,{
Entity(Box<E>),
Key(<E as Keyed>::Key),
}Expand description
The Join struct that hold either an entity or its key.
Variants§
Entity(Box<E>)
Full entity is held. The entity is wrapped inside a Box. That does allow
circular dependencies, in theory. In practice the compiler goes wild :(
Key(<E as Keyed>::Key)
The entities key
Implementations§
Source§impl<T> Join<T>where
T: Keyed,
impl<T> Join<T>where
T: Keyed,
Sourcepub fn with_entity(entity: T) -> Join<T>
pub fn with_entity(entity: T) -> Join<T>
Constructs join for entity
Sourcepub fn entity_mut(&mut self) -> Option<&mut T>
pub fn entity_mut(&mut self) -> Option<&mut T>
Returns mutable entity or None, if key is held.
Sourcepub fn entity_or_err<E>(&self, err: E) -> Result<&T, E>
pub fn entity_or_err<E>(&self, err: E) -> Result<&T, E>
Returns entity or error E, if key is held.
Sourcepub fn entity_mut_or_err<E>(&mut self, err: E) -> Result<&mut T, E>
pub fn entity_mut_or_err<E>(&mut self, err: E) -> Result<&mut T, E>
Returns mut entity or error E, if key is held.
Sourcepub fn key(&self) -> <T as Keyed>::Key
pub fn key(&self) -> <T as Keyed>::Key
Returns a key. If entity is held, key is taken from that entity
Sourcepub fn into_entity(self) -> Result<T, ToqlError>
pub fn into_entity(self) -> Result<T, ToqlError>
Unwraps join into its entity. Can fail
Trait Implementations§
Source§impl<T, R, E> FromRow<R, E> for Join<T>
impl<T, R, E> FromRow<R, E> for Join<T>
Source§fn forward<'a, I>(iter: &mut I) -> Result<usize, E>
fn forward<'a, I>(iter: &mut I) -> Result<usize, E>
Returns the number of selects
This is needed to advance the iterator and
the row index.
The Deserializer needs this information to skip left joins
that have fields selected but are null.
Those left joins cause select information in the select stream
that must be skipped.
Source§fn from_row<'a, I>(
row: &R,
i: &mut usize,
iter: &mut I,
) -> Result<Option<Join<T>>, E>
fn from_row<'a, I>( row: &R, i: &mut usize, iter: &mut I, ) -> Result<Option<Join<T>>, E>
Read row values into struct, starting from index.
Advances iter and index
Returns None for value unselected values or joined entities that have null keys.
Return Error, if value is selected, but cannot be converted.
Source§impl<T> TreeIdentity for Join<T>
impl<T> TreeIdentity for Join<T>
Source§impl<T> TreeInsert for Join<T>
impl<T> TreeInsert for Join<T>
Source§fn columns<'a, I>(descendents: I) -> Result<SqlExpr, ToqlError>
fn columns<'a, I>(descendents: I) -> Result<SqlExpr, ToqlError>
Return columns of struct located at
descendents.Source§fn values<'a, 'b, I, J>(
&self,
descendents: I,
roles: &HashSet<String>,
should_insert: &mut J,
values: &mut SqlExpr,
) -> Result<(), ToqlError>
fn values<'a, 'b, I, J>( &self, descendents: I, roles: &HashSet<String>, should_insert: &mut J, values: &mut SqlExpr, ) -> Result<(), ToqlError>
Return values of structs located at
descendents.
The should_insert argument allows the method to only insert a part of the collection.
This is needed to deal with newly added merges.Source§impl<T> TreePredicate for Join<T>
impl<T> TreePredicate for Join<T>
Source§impl<T> TreeUpdate for Join<T>
impl<T> TreeUpdate for Join<T>
impl<E> Eq for Join<E>
impl<E> StructuralPartialEq for Join<E>where
E: Keyed,
Auto Trait Implementations§
impl<E> Freeze for Join<E>
impl<E> RefUnwindSafe for Join<E>
impl<E> Send for Join<E>
impl<E> Sync for Join<E>
impl<E> Unpin for Join<E>
impl<E> UnwindSafe for Join<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