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::Key)
The entities key
Implementations
sourceimpl<T> Join<T> where
T: Keyed,
impl<T> Join<T> where
T: Keyed,
sourcepub fn with_entity(entity: T) -> Self
pub fn with_entity(entity: T) -> Self
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 where
<T as Keyed>::Key: Clone,
pub fn key(&self) -> <T as Keyed>::Key where
<T as Keyed>::Key: Clone,
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
sourceimpl<T, R, E> FromRow<R, E> for Join<T> where
T: Keyed + FromRow<R, E>,
E: From<ToqlError>,
impl<T, R, E> FromRow<R, E> for Join<T> where
T: Keyed + FromRow<R, E>,
E: From<ToqlError>,
sourcefn forward<'a, I>(iter: &mut I) -> Result<usize, E> where
I: Iterator<Item = &'a Select>,
Self: Sized,
fn forward<'a, I>(iter: &mut I) -> Result<usize, E> where
I: Iterator<Item = &'a Select>,
Self: Sized,
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. Read more
sourcefn from_row<'a, I>(
row: &R,
i: &mut usize,
iter: &mut I
) -> Result<Option<Self>, E> where
I: Iterator<Item = &'a Select> + Clone,
Self: Sized,
fn from_row<'a, I>(
row: &R,
i: &mut usize,
iter: &mut I
) -> Result<Option<Self>, E> where
I: Iterator<Item = &'a Select> + Clone,
Self: Sized,
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. Read more
sourceimpl<T> TreeIdentity for Join<T> where
T: Keyed,
<T as Keyed>::Key: Clone,
T: TreeIdentity,
<T as Keyed>::Key: TryFrom<Vec<SqlArg>, Error = ToqlError>,
impl<T> TreeIdentity for Join<T> where
T: Keyed,
<T as Keyed>::Key: Clone,
T: TreeIdentity,
<T as Keyed>::Key: TryFrom<Vec<SqlArg>, Error = ToqlError>,
sourceimpl<T, R, E> TreeIndex<R, E> for Join<T> where
T: Keyed + TreeIndex<R, E>,
E: From<ToqlError>,
impl<T, R, E> TreeIndex<R, E> for Join<T> where
T: Keyed + TreeIndex<R, E>,
E: From<ToqlError>,
sourceimpl<T> TreeInsert for Join<T> where
T: Keyed + TreeInsert + Mapped,
<T as Keyed>::Key: Key + Clone,
impl<T> TreeInsert for Join<T> where
T: Keyed + TreeInsert + Mapped,
<T as Keyed>::Key: Key + Clone,
sourcefn columns<'a, I>(descendents: I) -> Result<SqlExpr, ToqlError> where
I: Iterator<Item = FieldPath<'a>>,
fn columns<'a, I>(descendents: I) -> Result<SqlExpr, ToqlError> where
I: Iterator<Item = FieldPath<'a>>,
Return columns of struct located at descendents
.
sourcefn values<'a, 'b, I, J>(
&self,
descendents: I,
roles: &HashSet<String>,
should_insert: &mut J,
values: &mut SqlExpr
) -> Result<(), ToqlError> where
I: Iterator<Item = FieldPath<'a>> + Clone,
J: Iterator<Item = &'b bool>,
fn values<'a, 'b, I, J>(
&self,
descendents: I,
roles: &HashSet<String>,
should_insert: &mut J,
values: &mut SqlExpr
) -> Result<(), ToqlError> where
I: Iterator<Item = FieldPath<'a>> + Clone,
J: Iterator<Item = &'b bool>,
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. Read more
sourceimpl<T, R, E> TreeMerge<R, E> for Join<T> where
T: Keyed + TreeMerge<R, E>,
E: From<ToqlError>,
impl<T, R, E> TreeMerge<R, E> for Join<T> where
T: Keyed + TreeMerge<R, E>,
E: From<ToqlError>,
sourceimpl<T> TreePredicate for Join<T> where
T: Keyed,
<T as Keyed>::Key: Clone,
T: TreePredicate,
impl<T> TreePredicate for Join<T> where
T: Keyed,
<T as Keyed>::Key: Clone,
T: TreePredicate,
sourceimpl<T> TreeUpdate for Join<T> where
T: Keyed + TreeUpdate + Mapped,
<T as Keyed>::Key: Key + Clone,
impl<T> TreeUpdate for Join<T> where
T: Keyed + TreeUpdate + Mapped,
<T as Keyed>::Key: Key + Clone,
impl<E: Eq + Keyed> Eq for Join<E> where
E::Key: Eq,
impl<E: Keyed> StructuralEq for Join<E>
impl<E: Keyed> StructuralPartialEq for Join<E>
Auto Trait Implementations
impl<E> RefUnwindSafe for Join<E> where
E: RefUnwindSafe,
<E as Keyed>::Key: RefUnwindSafe,
impl<E> Send for Join<E> where
E: Send,
<E as Keyed>::Key: Send,
impl<E> Sync for Join<E> where
E: Sync,
<E as Keyed>::Key: Sync,
impl<E> Unpin for Join<E> where
<E as Keyed>::Key: Unpin,
impl<E> UnwindSafe for Join<E> where
E: UnwindSafe,
<E as Keyed>::Key: UnwindSafe,
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> Instrument for T
impl<T> Instrument for T
sourcefn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
sourcefn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
sourceimpl<T> ToOwned for T where
T: Clone,
impl<T> ToOwned for T where
T: Clone,
type Owned = T
type Owned = T
The resulting type after obtaining ownership.
sourcefn clone_into(&self, target: &mut T)
fn clone_into(&self, target: &mut T)
toowned_clone_into
)Uses borrowed data to replace owned data, usually by cloning. Read more
sourceimpl<T> WithSubscriber for T
impl<T> WithSubscriber for T
sourcefn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
S: Into<Dispatch>,
fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
S: Into<Dispatch>,
Attaches the provided Subscriber
to this type, returning a
WithDispatch
wrapper. Read more
sourcefn with_current_subscriber(self) -> WithDispatch<Self>
fn with_current_subscriber(self) -> WithDispatch<Self>
Attaches the current default Subscriber
to this type, returning a
WithDispatch
wrapper. Read more