Skip to main content

Scoped

Struct Scoped 

Source
pub struct Scoped<Marker, Scope, Used = ()>(/* private fields */);
Expand description

SELECT marker that also carries the query’s scope and the sources its clauses read.

.from(...) wraps the select marker (SelectStar, SelectCols, …) in this type, and each join and clause updates it.

  • Marker: how rows decode (see crate::row).
  • Scope: the FROM/JOIN sources, newest first.
  • Used: a sources tree of every clause added so far (JOIN ON, WHERE, GROUP BY, HAVING, ORDER BY), each wrapped in At with the scope it was written against.

Used is checked by .all(), .get() and .rows() (through MarkerScopeValidFor). When the query is used as a subquery, Used is checked against the outer query instead, so a correlated subquery can read its outer query’s tables.

Trait Implementations§

Source§

impl<Marker, Scope, Used> Clone for Scoped<Marker, Scope, Used>

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<Marker, Scope, Used> Copy for Scoped<Marker, Scope, Used>

Source§

impl<Marker, Scope, Used> Debug for Scoped<Marker, Scope, Used>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<RowRef, R, M, Scope, Used> DecodeSelectedRef<RowRef, R> for Scoped<M, Scope, Used>
where M: DecodeSelectedRef<RowRef, R>,

Source§

fn decode(row: RowRef) -> Result<R, DrizzleError>

Decodes row into R. Read more
Source§

impl<Marker, Scope, Used> Default for Scoped<Marker, Scope, Used>

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl<Marker, Scope, Used> HasScope for Scoped<Marker, Scope, Used>

Source§

type Scope = Scope

The FROM/JOIN sources.
Source§

type Used = Used

Sources of every clause added so far.
Source§

type With<Sources> = Scoped<Marker, Scope, (Used, At<Scope, Sources>)>

This marker after adding a clause that reads Sources, recorded against the current scope.
Source§

impl<M, Scope, Used, Row, J, On> JoinStep<Row, J, FullJoin, On> for Scoped<M, Scope, Used>
where M: JoinRow<Row, J, FullJoin>, J: ScopeEntry, Scope: OuterJoinScope,

Source§

type Marker = Scoped<M, Cons<OuterJoined<J>, <Scope as OuterJoinScope>::Out>, ((Used, <J as ScopeEntry>::Sources), At<Cons<OuterJoined<J>, <Scope as OuterJoinScope>::Out>, On>)>

The new marker, with Joined pushed into its scope.
Source§

type Row = <M as JoinRow<Row, J, FullJoin>>::Row

The new inferred row type.
Source§

impl<M, Scope, Used, Row, J, On> JoinStep<Row, J, InnerJoin, On> for Scoped<M, Scope, Used>
where M: JoinRow<Row, J, InnerJoin>, J: ScopeEntry,

Source§

type Marker = Scoped<M, Cons<J, Scope>, ((Used, <J as ScopeEntry>::Sources), At<Cons<J, Scope>, On>)>

The new marker, with Joined pushed into its scope.
Source§

type Row = <M as JoinRow<Row, J, InnerJoin>>::Row

The new inferred row type.
Source§

impl<M, Scope, Used, Row, J, On> JoinStep<Row, J, Lateral<InnerJoin>, On> for Scoped<M, Scope, Used>
where M: JoinRow<Row, J, InnerJoin>, J: ScopeEntry,

Source§

type Marker = Scoped<M, Cons<J, Scope>, ((Used, ()), At<Cons<J, Scope>, (On, <J as ScopeEntry>::Sources)>)>

The new marker, with Joined pushed into its scope.
Source§

type Row = <M as JoinRow<Row, J, InnerJoin>>::Row

The new inferred row type.
Source§

impl<M, Scope, Used, Row, J, On> JoinStep<Row, J, Lateral<LeftJoin>, On> for Scoped<M, Scope, Used>
where M: JoinRow<Row, J, LeftJoin>, J: ScopeEntry,

Source§

type Marker = Scoped<M, Cons<OuterJoined<J>, Scope>, ((Used, ()), At<Cons<OuterJoined<J>, Scope>, (On, <J as ScopeEntry>::Sources)>)>

The new marker, with Joined pushed into its scope.
Source§

type Row = <M as JoinRow<Row, J, LeftJoin>>::Row

The new inferred row type.
Source§

impl<M, Scope, Used, Row, J, On> JoinStep<Row, J, LeftJoin, On> for Scoped<M, Scope, Used>
where M: JoinRow<Row, J, LeftJoin>, J: ScopeEntry,

Source§

type Marker = Scoped<M, Cons<OuterJoined<J>, Scope>, ((Used, <J as ScopeEntry>::Sources), At<Cons<OuterJoined<J>, Scope>, On>)>

The new marker, with Joined pushed into its scope.
Source§

type Row = <M as JoinRow<Row, J, LeftJoin>>::Row

The new inferred row type.
Source§

impl<M, Scope, Used, Row, J, On> JoinStep<Row, J, RightJoin, On> for Scoped<M, Scope, Used>
where M: JoinRow<Row, J, RightJoin>, J: ScopeEntry, Scope: OuterJoinScope,

Source§

type Marker = Scoped<M, Cons<J, <Scope as OuterJoinScope>::Out>, ((Used, <J as ScopeEntry>::Sources), At<Cons<J, <Scope as OuterJoinScope>::Out>, On>)>

The new marker, with Joined pushed into its scope.
Source§

type Row = <M as JoinRow<Row, J, RightJoin>>::Row

The new inferred row type.
Source§

impl<Scope, Used, Cols, Head, Tail, Proof> MarkerAggValidFor<Cons<Head, Tail>, Proof> for Scoped<SelectCols<Cols>, Scope, Used>
where Cols: ScalarColumnsIn<Cons<Head, Tail>, Proof>,

Source§

impl<Scope, Used, Head, Tail> MarkerAggValidFor<Cons<Head, Tail>> for Scoped<SelectStar, Scope, Used>

Source§

impl<Scope, Used, Head, Tail> MarkerAggValidFor<Cons<Head, Tail>> for Scoped<SelectExpr, Scope, Used>

Source§

impl<Scope, Used, R, Head, Tail> MarkerAggValidFor<Cons<Head, Tail>> for Scoped<SelectAs<R>, Scope, Used>

Source§

impl<Scope, Used, Cols, T, Proof> MarkerAggValidFor<PkGroup<T>, Proof> for Scoped<SelectCols<Cols>, Scope, Used>
where Cols: ScalarColumnsIn<PkGroup<T>, Proof>,

Source§

impl<Scope, Used, T> MarkerAggValidFor<PkGroup<T>> for Scoped<SelectStar, Scope, Used>

Source§

impl<Scope, Used, T> MarkerAggValidFor<PkGroup<T>> for Scoped<SelectExpr, Scope, Used>

Source§

impl<Scope, Used, R, T> MarkerAggValidFor<PkGroup<T>> for Scoped<SelectAs<R>, Scope, Used>

Source§

impl<Row: ?Sized, Cols, Scope, Used, Inferred, Actual, UsedProof, ColsProof> MarkerColumnCountValid<Row, Inferred, Actual, (UsedProof, ColsProof)> for Scoped<SelectCols<Cols>, Scope, Used>
where Cols: SelectedExpressionList, Cols::Expressions: ProjectionIn<Scope, ColsProof>, Actual: RowColumnList<Row>, <Cols::Expressions as ProjectionIn<Scope, ColsProof>>::Columns: TypeListCompatible<Row, <Actual as RowColumnList<Row>>::Columns>,

Source§

impl<Row: ?Sized, Table, Used, Inferred, Actual, Proof> MarkerColumnCountValid<Row, Inferred, Actual, Proof> for Scoped<SelectStar, Cons<Table, Nil>, Used>

Single-source SELECT *: the table model may be decoded into any row type.

Source§

impl<Row: ?Sized, First, Second, Rest, Used, Inferred, Actual, Proof> MarkerColumnCountValid<Row, Inferred, Actual, Proof> for Scoped<SelectStar, Cons<First, Cons<Second, Rest>>, Used>
where Inferred: JoinedStarRow<Actual>,

Joined SELECT *: the decode target must keep the inferred row shape, with Option on every source that an outer join can leave NULL.

Source§

impl<Row: ?Sized, Scope, Used, Inferred, Actual, Proof> MarkerColumnCountValid<Row, Inferred, Actual, Proof> for Scoped<SelectExpr, Scope, Used>
where Inferred: SameType<Actual>,

Source§

impl<Row: ?Sized, R, Scope, Used, Inferred, Actual, Proof> MarkerColumnCountValid<Row, Inferred, Actual, Proof> for Scoped<SelectAs<R>, Scope, Used>

FromRow selectors are checked by MarkerScopeValidFor.

Source§

impl<Cols, Scope, Used, UsedProof, ColsProof> MarkerScopeValidFor<(UsedProof, ColsProof)> for Scoped<SelectCols<Cols>, Scope, Used>
where Used: SourcesIn<Nil, UsedProof>, Cols: SelectedExpressionList, Cols::Expressions: ProjectionIn<Scope, ColsProof>,

Source§

impl<R, Scope, Used, UsedProof, FieldsProof> MarkerScopeValidFor<(UsedProof, FieldsProof)> for Scoped<SelectAs<R>, Scope, Used>
where Used: SourcesIn<Nil, UsedProof>, R: SelectTableFields, R::TableFields: TableFieldsIn<Scope, FieldsProof>,

Source§

impl<Scope, Used, Proof> MarkerScopeValidFor<Proof> for Scoped<SelectStar, Scope, Used>
where Used: SourcesIn<Nil, Proof>,

Source§

impl<Scope, Used, Proof> MarkerScopeValidFor<Proof> for Scoped<SelectExpr, Scope, Used>
where Used: SourcesIn<Nil, Proof>,

Source§

impl<M, Scope, Used, T> ResolveRow<T> for Scoped<M, Scope, Used>
where M: ResolveRow<T>,

Source§

type Row = <M as ResolveRow<T>>::Row

The inferred row type.
Source§

impl<M: SelectSources, Scope, Used> SelectSources for Scoped<M, Scope, Used>

Source§

type Sources = (Used, At<Scope, <M as SelectSources>::Sources>)

The sources tree the outer query must contain.
Source§

impl<M, Scope, Used, Other: SelectSources> SetOperand<Other> for Scoped<M, Scope, Used>

Source§

type Combined = Scoped<M, Scope, (Used, <Other as SelectSources>::Sources)>

The marker of the compound query.
Source§

impl<M, Scope, Used> StrictDecodeMarker for Scoped<M, Scope, Used>

Source§

impl<'a, V, M, Scope, Used> SubqueryType<'a, V> for Scoped<M, Scope, Used>
where V: SQLParam + 'a, M: SubqueryType<'a, V>,

Source§

type SQLType = <M as SubqueryType<'a, V>>::SQLType

SQL type of the subquery: the column’s type, or a tuple of types.

Auto Trait Implementations§

§

impl<Marker, Scope, Used> Freeze for Scoped<Marker, Scope, Used>

§

impl<Marker, Scope, Used> RefUnwindSafe for Scoped<Marker, Scope, Used>

§

impl<Marker, Scope, Used> Send for Scoped<Marker, Scope, Used>

§

impl<Marker, Scope, Used> Sync for Scoped<Marker, Scope, Used>

§

impl<Marker, Scope, Used> Unpin for Scoped<Marker, Scope, Used>

§

impl<Marker, Scope, Used> UnsafeUnpin for Scoped<Marker, Scope, Used>

§

impl<Marker, Scope, Used> UnwindSafe for Scoped<Marker, Scope, Used>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<Joined, From> JoinKey<From, JoinReverse> for Joined
where From: Joinable<Joined> + ?Sized,

Source§

fn pairs() -> &'static [(&'static str, &'static str)]

(joined_column, from_column) pairs the ON condition matches, in key order, read through Self::pair.
Source§

fn pair(pair: &(&'static str, &'static str)) -> (&'static str, &'static str)

The (joined_column, from_column) names of pair.
Source§

impl<List> ListIncludes<Nil, ()> for List

Source§

impl<Mk> MarkerAggValidFor<()> for Mk

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> TypeEq<T> for T