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 (seecrate::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 inAtwith 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§
impl<Marker, Scope, Used> Copy for Scoped<Marker, Scope, Used>
Source§impl<RowRef, R, M, Scope, Used> DecodeSelectedRef<RowRef, R> for Scoped<M, Scope, Used>where
M: DecodeSelectedRef<RowRef, R>,
impl<RowRef, R, M, Scope, Used> DecodeSelectedRef<RowRef, R> for Scoped<M, Scope, Used>where
M: DecodeSelectedRef<RowRef, R>,
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,
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>)>
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§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,
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§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,
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§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,
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§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,
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>)>
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§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,
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,
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>,
impl<Scope, Used, Head, Tail> MarkerAggValidFor<Cons<Head, Tail>> for Scoped<SelectStar, Scope, Used>
impl<Scope, Used, Head, Tail> MarkerAggValidFor<Cons<Head, Tail>> for Scoped<SelectExpr, Scope, Used>
impl<Scope, Used, R, Head, Tail> MarkerAggValidFor<Cons<Head, Tail>> for Scoped<SelectAs<R>, Scope, Used>
impl<Scope, Used, Cols, T, Proof> MarkerAggValidFor<PkGroup<T>, Proof> for Scoped<SelectCols<Cols>, Scope, Used>where
Cols: ScalarColumnsIn<PkGroup<T>, Proof>,
impl<Scope, Used, T> MarkerAggValidFor<PkGroup<T>> for Scoped<SelectStar, Scope, Used>
impl<Scope, Used, T> MarkerAggValidFor<PkGroup<T>> for Scoped<SelectExpr, Scope, Used>
impl<Scope, Used, R, T> MarkerAggValidFor<PkGroup<T>> for Scoped<SelectAs<R>, Scope, Used>
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>,
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.
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.
impl<Row: ?Sized, Scope, Used, Inferred, Actual, Proof> MarkerColumnCountValid<Row, Inferred, Actual, Proof> for Scoped<SelectExpr, Scope, Used>where
Inferred: SameType<Actual>,
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.
impl<Cols, Scope, Used, UsedProof, ColsProof> MarkerScopeValidFor<(UsedProof, ColsProof)> for Scoped<SelectCols<Cols>, Scope, Used>
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>,
impl<Scope, Used, Proof> MarkerScopeValidFor<Proof> for Scoped<SelectStar, Scope, Used>
impl<Scope, Used, Proof> MarkerScopeValidFor<Proof> for Scoped<SelectExpr, Scope, Used>
Source§impl<M, Scope, Used, T> ResolveRow<T> for Scoped<M, Scope, Used>where
M: ResolveRow<T>,
impl<M, Scope, Used, T> ResolveRow<T> for Scoped<M, Scope, Used>where
M: ResolveRow<T>,
Source§type Row = <M as ResolveRow<T>>::Row
type Row = <M as ResolveRow<T>>::Row
The inferred row type.
Source§impl<M: SelectSources, Scope, Used> SelectSources for Scoped<M, Scope, Used>
impl<M: SelectSources, Scope, Used> SelectSources for Scoped<M, Scope, Used>
Source§impl<M, Scope, Used, Other: SelectSources> SetOperand<Other> for Scoped<M, Scope, Used>
impl<M, Scope, Used, Other: SelectSources> SetOperand<Other> for Scoped<M, Scope, Used>
impl<M, Scope, Used> StrictDecodeMarker for Scoped<M, Scope, Used>where
M: StrictDecodeMarker,
Source§impl<'a, V, M, Scope, Used> SubqueryType<'a, V> for Scoped<M, Scope, Used>where
V: SQLParam + 'a,
M: SubqueryType<'a, V>,
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
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> 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