pub enum HirScalarExpr {
Column(ColumnRef, TreatAsEqual<Option<Arc<str>>>),
Parameter(usize, TreatAsEqual<Option<Arc<str>>>),
Literal(Row, SqlColumnType, TreatAsEqual<Option<Arc<str>>>),
CallUnmaterializable(UnmaterializableFunc, TreatAsEqual<Option<Arc<str>>>),
CallUnary {
func: UnaryFunc,
expr: Box<HirScalarExpr>,
name: TreatAsEqual<Option<Arc<str>>>,
},
CallBinary {
func: BinaryFunc,
expr1: Box<HirScalarExpr>,
expr2: Box<HirScalarExpr>,
name: TreatAsEqual<Option<Arc<str>>>,
},
CallVariadic {
func: VariadicFunc,
exprs: Vec<HirScalarExpr>,
name: TreatAsEqual<Option<Arc<str>>>,
},
If {
cond: Box<HirScalarExpr>,
then: Box<HirScalarExpr>,
els: Box<HirScalarExpr>,
name: TreatAsEqual<Option<Arc<str>>>,
},
Exists(Box<HirRelationExpr>, TreatAsEqual<Option<Arc<str>>>),
Select(Box<HirRelationExpr>, TreatAsEqual<Option<Arc<str>>>),
Windowing(WindowExpr, TreatAsEqual<Option<Arc<str>>>),
}Expand description
Just like mz_expr::MirScalarExpr, except where otherwise noted below.
Variants§
Column(ColumnRef, TreatAsEqual<Option<Arc<str>>>)
Unlike mz_expr::MirScalarExpr, we can nest HirRelationExprs via eg Exists. This means that a variable could refer to a column of the current input, or to a column of an outer relation. We use ColumnRef to denote the difference.
Parameter(usize, TreatAsEqual<Option<Arc<str>>>)
Literal(Row, SqlColumnType, TreatAsEqual<Option<Arc<str>>>)
CallUnmaterializable(UnmaterializableFunc, TreatAsEqual<Option<Arc<str>>>)
CallUnary
CallBinary
Fields
func: BinaryFuncexpr1: Box<HirScalarExpr>expr2: Box<HirScalarExpr>name: TreatAsEqual<Option<Arc<str>>>CallVariadic
If
Fields
cond: Box<HirScalarExpr>then: Box<HirScalarExpr>els: Box<HirScalarExpr>name: TreatAsEqual<Option<Arc<str>>>Exists(Box<HirRelationExpr>, TreatAsEqual<Option<Arc<str>>>)
Returns true if expr returns any rows
Select(Box<HirRelationExpr>, TreatAsEqual<Option<Arc<str>>>)
Given expr with arity 1. If expr returns:
- 0 rows, return NULL
- 1 row, return the value of that row
-
1 rows, we return an error
Windowing(WindowExpr, TreatAsEqual<Option<Arc<str>>>)
Implementations§
Source§impl HirScalarExpr
impl HirScalarExpr
pub fn name(&self) -> Option<Arc<str>>
Sourcepub fn bind_parameters(
&mut self,
scx: &StatementContext<'_>,
lifetime: QueryLifetime,
params: &Params,
) -> Result<(), PlanError>
pub fn bind_parameters( &mut self, scx: &StatementContext<'_>, lifetime: QueryLifetime, params: &Params, ) -> Result<(), PlanError>
Replaces any parameter references in the expression with the
corresponding datum in params.
Sourcepub fn splice_parameters(&mut self, params: &[HirScalarExpr], depth: usize)
pub fn splice_parameters(&mut self, params: &[HirScalarExpr], depth: usize)
Like HirScalarExpr::bind_parameters, except that parameters are
replaced with the corresponding expression fragment from params rather
than a datum.
Specifically, the parameter $1 will be replaced with params[0], the
parameter $2 will be replaced with params[1], and so on. Parameters
in self that refer to invalid indices of params will cause a panic.
Column references in parameters will be corrected to account for the depth at which they are spliced.
Sourcepub fn contains_temporal(&self) -> bool
pub fn contains_temporal(&self) -> bool
Whether the expression contains an UnmaterializableFunc::MzNow call.
Sourcepub fn contains_unmaterializable(&self) -> bool
pub fn contains_unmaterializable(&self) -> bool
Whether the expression contains any UnmaterializableFunc call.
Sourcepub fn column(index: usize) -> HirScalarExpr
pub fn column(index: usize) -> HirScalarExpr
Constructs an unnamed column reference in the current scope.
Use HirScalarExpr::named_column when a name is known.
Use HirScalarExpr::unnamed_column for a ColumnRef.
Sourcepub fn unnamed_column(cr: ColumnRef) -> HirScalarExpr
pub fn unnamed_column(cr: ColumnRef) -> HirScalarExpr
Constructs an unnamed column reference.
Sourcepub fn named_column(cr: ColumnRef, name: Arc<str>) -> HirScalarExpr
pub fn named_column(cr: ColumnRef, name: Arc<str>) -> HirScalarExpr
Constructs a named column reference.
Names are interned by a NameManager.
pub fn parameter(n: usize) -> HirScalarExpr
pub fn literal(datum: Datum<'_>, scalar_type: SqlScalarType) -> HirScalarExpr
pub fn literal_true() -> HirScalarExpr
pub fn literal_false() -> HirScalarExpr
pub fn literal_null(scalar_type: SqlScalarType) -> HirScalarExpr
pub fn literal_1d_array( datums: Vec<Datum<'_>>, element_scalar_type: SqlScalarType, ) -> Result<HirScalarExpr, PlanError>
pub fn as_literal(&self) -> Option<Datum<'_>>
pub fn is_literal_true(&self) -> bool
pub fn is_literal_false(&self) -> bool
pub fn is_literal_null(&self) -> bool
Sourcepub fn is_constant(&self) -> bool
pub fn is_constant(&self) -> bool
Return true iff self consists only of literals, materializable function calls, and
if-else statements.
pub fn call_unary(self, func: UnaryFunc) -> Self
pub fn call_binary<B: Into<BinaryFunc>>(self, other: Self, func: B) -> Self
pub fn call_unmaterializable(func: UnmaterializableFunc) -> Self
pub fn call_variadic(func: VariadicFunc, exprs: Vec<Self>) -> Self
pub fn if_then_else(cond: Self, then: Self, els: Self) -> Self
pub fn windowing(expr: WindowExpr) -> Self
pub fn or(self, other: Self) -> Self
pub fn and(self, other: Self) -> Self
pub fn not(self) -> Self
pub fn call_is_null(self) -> Self
Sourcepub fn variadic_and(args: Vec<HirScalarExpr>) -> HirScalarExpr
pub fn variadic_and(args: Vec<HirScalarExpr>) -> HirScalarExpr
Calls AND with the given arguments. Simplifies if 0 or 1 args.
Sourcepub fn variadic_or(args: Vec<HirScalarExpr>) -> HirScalarExpr
pub fn variadic_or(args: Vec<HirScalarExpr>) -> HirScalarExpr
Calls OR with the given arguments. Simplifies if 0 or 1 args.
pub fn take(&mut self) -> Self
Sourcepub fn visit_columns<F>(&self, depth: usize, f: &mut F)
👎Deprecated: Redefine this based on the Visit and VisitChildren methods.
pub fn visit_columns<F>(&self, depth: usize, f: &mut F)
Visit and VisitChildren methods.Visits the column references in this scalar expression.
The depth argument should indicate the subquery nesting depth of the expression,
which will be incremented with each subquery entered and presented to the supplied
function f.
Sourcepub fn visit_columns_mut<F>(&mut self, depth: usize, f: &mut F)
👎Deprecated: Redefine this based on the Visit and VisitChildren methods.
pub fn visit_columns_mut<F>(&mut self, depth: usize, f: &mut F)
Visit and VisitChildren methods.Like visit_columns, but permits mutating the column references.
Sourcepub fn visit_columns_referring_to_root_level<F>(&self, f: &mut F)
pub fn visit_columns_referring_to_root_level<F>(&self, f: &mut F)
Visits those column references in this scalar expression that refer to the root
level. These include column references that are at the root level, as well as column
references that are at a deeper subquery nesting depth, but refer back to the root level.
(Note that even if self is embedded inside a larger expression, we consider the
“root level” to be self’s level.)
Sourcepub fn visit_columns_referring_to_root_level_mut<F>(&mut self, f: &mut F)
pub fn visit_columns_referring_to_root_level_mut<F>(&mut self, f: &mut F)
Like visit_columns_referring_to_root_level, but permits mutating the column references.
Sourcepub fn visit_recursively<F, E>(&self, depth: usize, f: &mut F) -> Result<(), E>
👎Deprecated: Redefine this based on the Visit and VisitChildren methods.
pub fn visit_recursively<F, E>(&self, depth: usize, f: &mut F) -> Result<(), E>
Visit and VisitChildren methods.Like visit but it enters the subqueries visiting the scalar expressions contained
in them. It takes the current depth of the expression and increases it when
entering a subquery.
Sourcepub fn visit_recursively_mut<F, E>(
&mut self,
depth: usize,
f: &mut F,
) -> Result<(), E>
👎Deprecated: Redefine this based on the Visit and VisitChildren methods.
pub fn visit_recursively_mut<F, E>( &mut self, depth: usize, f: &mut F, ) -> Result<(), E>
Visit and VisitChildren methods.Like visit_recursively, but permits mutating the scalar expressions.
Sourcefn simplify_to_literal(self) -> Option<Row>
fn simplify_to_literal(self) -> Option<Row>
Attempts to simplify self into a literal.
Returns None if self is not constant and therefore can’t be simplified to a literal, or if an evaluation error occurs during simplification, or if self contains
- a subquery
- a column reference to an outer level
- a parameter
- a window function call
Sourcefn simplify_to_literal_with_result(self) -> Result<Row, PlanError>
fn simplify_to_literal_with_result(self) -> Result<Row, PlanError>
Simplifies self into a literal. If this is not possible (e.g., because self is not constant
or an evaluation error occurs during simplification), it returns
PlanError::ConstantExpressionSimplificationFailed.
The returned error is an internal error if the expression contains
- a subquery
- a column reference to an outer level
- a parameter
- a window function call
TODO: use this everywhere instead of simplify_to_literal, so that we don’t hide the error
msg.
Sourcepub fn into_literal_int64(self) -> Option<i64>
pub fn into_literal_int64(self) -> Option<i64>
Attempts to simplify this expression to a literal 64-bit integer.
Returns None if this expression cannot be simplified, e.g. because it
contains non-literal values.
§Panics
Panics if this expression does not have type SqlScalarType::Int64.
Sourcepub fn into_literal_string(self) -> Option<String>
pub fn into_literal_string(self) -> Option<String>
Attempts to simplify this expression to a literal string.
Returns None if this expression cannot be simplified, e.g. because it
contains non-literal values.
§Panics
Panics if this expression does not have type SqlScalarType::String.
Sourcepub fn into_literal_mz_timestamp(self) -> Option<Timestamp>
pub fn into_literal_mz_timestamp(self) -> Option<Timestamp>
Attempts to simplify this expression to a literal MzTimestamp.
Returns None if the expression simplifies to null or if the expression cannot be
simplified, e.g. because it contains non-literal values or a cast fails.
TODO: Make this (and the other similar fns above) return Result, so that we can show the
error when it fails. (E.g., there can be non-trivial cast errors.)
See try_into_literal_int64 as an example.
§Panics
Panics if this expression does not have type SqlScalarType::MzTimestamp.
Sourcepub fn try_into_literal_int64(self) -> Result<i64, PlanError>
pub fn try_into_literal_int64(self) -> Result<i64, PlanError>
Attempts to simplify this expression of SqlScalarType::Int64 to a literal Int64 and
returns it as an i64.
Returns PlanError::ConstantExpressionSimplificationFailed if
- it’s not a constant expression (as determined by
is_constant) - evaluates to null
- an EvalError occurs during evaluation (e.g., a cast fails)
§Panics
Panics if this expression does not have type SqlScalarType::Int64.
pub fn contains_parameters(&self) -> bool
Source§impl HirScalarExpr
impl HirScalarExpr
Sourcefn applied_to(
self,
id_gen: &mut IdGen,
col_map: &ColumnMap,
cte_map: &mut BTreeMap<LocalId, CteDesc>,
inner: &mut MirRelationExpr,
subquery_map: &Option<&BTreeMap<HirScalarExpr, usize>>,
context: &Context<'_>,
) -> Result<MirScalarExpr, PlanError>
fn applied_to( self, id_gen: &mut IdGen, col_map: &ColumnMap, cte_map: &mut BTreeMap<LocalId, CteDesc>, inner: &mut MirRelationExpr, subquery_map: &Option<&BTreeMap<HirScalarExpr, usize>>, context: &Context<'_>, ) -> Result<MirScalarExpr, PlanError>
Rewrite self into a mz_expr::ScalarExpr which can be applied to the modified inner.
This method is responsible for decorrelating subqueries in self by introducing further columns
to inner, and rewriting self to refer to its physical columns (specified by usize positions).
The most complicated logic is for the scalar expressions that involve subqueries, each of which are
documented in more detail closer to their logic.
This process presumes that inner is the result of decorrelation, meaning its first several columns
may be inherited from outer relations. The col_map column map should provide specific offsets where
each of these references can be found.
fn window_func_applied_to<F>(
id_gen: &mut IdGen,
col_map: &ColumnMap,
cte_map: &mut BTreeMap<LocalId, CteDesc>,
inner: &mut MirRelationExpr,
subquery_map: &Option<&BTreeMap<HirScalarExpr, usize>>,
partition_by: Vec<HirScalarExpr>,
order_by: Vec<HirScalarExpr>,
mir_aggr_func: AggregateFunc,
lower_args: F,
context: &Context<'_>,
) -> Result<MirScalarExpr, PlanError>where
F: FnOnce(&mut IdGen, &ColumnMap, &mut BTreeMap<LocalId, CteDesc>, &mut MirRelationExpr, &Option<&BTreeMap<HirScalarExpr, usize>>, Vec<MirScalarExpr>, MirScalarExpr, SqlScalarType) -> Result<(MirScalarExpr, SqlColumnType), PlanError>,
Sourcefn lower_subqueries(
exprs: &[Self],
id_gen: &mut IdGen,
col_map: &ColumnMap,
cte_map: &mut BTreeMap<LocalId, CteDesc>,
inner: MirRelationExpr,
context: &Context<'_>,
) -> Result<(MirRelationExpr, BTreeMap<HirScalarExpr, usize>), PlanError>
fn lower_subqueries( exprs: &[Self], id_gen: &mut IdGen, col_map: &ColumnMap, cte_map: &mut BTreeMap<LocalId, CteDesc>, inner: MirRelationExpr, context: &Context<'_>, ) -> Result<(MirRelationExpr, BTreeMap<HirScalarExpr, usize>), PlanError>
Applies the subqueries in the given list of scalar expressions to every distinct value of the given relation and returns a join of the given relation with all the subqueries found, and the mapping of scalar expressions with columns projected by the returned join that will hold their results.
Rewrites self into a mz_expr::ScalarExpr.
Returns an internal error if the expression contains
- a subquery
- a column reference to an outer level
- a parameter
- a window function call
Should succeed if HirScalarExpr::is_constant would return true on self.
Trait Implementations§
Source§impl AbstractExpr for HirScalarExpr
impl AbstractExpr for HirScalarExpr
type Type = SqlColumnType
Source§fn typ(
&self,
outers: &[SqlRelationType],
inner: &SqlRelationType,
params: &BTreeMap<usize, SqlScalarType>,
) -> Self::Type
fn typ( &self, outers: &[SqlRelationType], inner: &SqlRelationType, params: &BTreeMap<usize, SqlScalarType>, ) -> Self::Type
Source§impl Clone for HirScalarExpr
impl Clone for HirScalarExpr
Source§fn clone(&self) -> HirScalarExpr
fn clone(&self) -> HirScalarExpr
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for HirScalarExpr
impl Debug for HirScalarExpr
Source§impl<'de> Deserialize<'de> for HirScalarExpr
impl<'de> Deserialize<'de> for HirScalarExpr
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Source§impl Display for HirScalarExpr
impl Display for HirScalarExpr
Source§impl From<HirScalarExpr> for CoercibleScalarExpr
impl From<HirScalarExpr> for CoercibleScalarExpr
Source§fn from(expr: HirScalarExpr) -> CoercibleScalarExpr
fn from(expr: HirScalarExpr) -> CoercibleScalarExpr
Source§impl Hash for HirScalarExpr
impl Hash for HirScalarExpr
Source§impl Ord for HirScalarExpr
impl Ord for HirScalarExpr
Source§fn cmp(&self, other: &HirScalarExpr) -> Ordering
fn cmp(&self, other: &HirScalarExpr) -> Ordering
1.21.0 · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Source§impl PartialEq for HirScalarExpr
impl PartialEq for HirScalarExpr
Source§impl PartialOrd for HirScalarExpr
impl PartialOrd for HirScalarExpr
Source§impl ScalarOps for HirScalarExpr
impl ScalarOps for HirScalarExpr
fn match_col_ref(&self) -> Option<usize>
fn references(&self, column: usize) -> bool
Source§impl Serialize for HirScalarExpr
impl Serialize for HirScalarExpr
Source§impl VisitChildren<HirScalarExpr> for AggregateWindowExpr
impl VisitChildren<HirScalarExpr> for AggregateWindowExpr
Source§fn visit_children<F>(&self, f: F)where
F: FnMut(&HirScalarExpr),
fn visit_children<F>(&self, f: F)where
F: FnMut(&HirScalarExpr),
f to each direct child.Source§fn visit_mut_children<F>(&mut self, f: F)where
F: FnMut(&mut HirScalarExpr),
fn visit_mut_children<F>(&mut self, f: F)where
F: FnMut(&mut HirScalarExpr),
f to each direct child.Source§fn try_visit_children<F, E>(&self, f: F) -> Result<(), E>
fn try_visit_children<F, E>(&self, f: F) -> Result<(), E>
f to each direct child. Read moreSource§impl VisitChildren<HirScalarExpr> for HirRelationExpr
impl VisitChildren<HirScalarExpr> for HirRelationExpr
Source§fn visit_children<F>(&self, f: F)where
F: FnMut(&HirScalarExpr),
fn visit_children<F>(&self, f: F)where
F: FnMut(&HirScalarExpr),
f to each direct child.Source§fn visit_mut_children<F>(&mut self, f: F)where
F: FnMut(&mut HirScalarExpr),
fn visit_mut_children<F>(&mut self, f: F)where
F: FnMut(&mut HirScalarExpr),
f to each direct child.Source§fn try_visit_children<F, E>(&self, f: F) -> Result<(), E>
fn try_visit_children<F, E>(&self, f: F) -> Result<(), E>
f to each direct child. Read moreSource§impl VisitChildren<HirScalarExpr> for HirScalarExpr
impl VisitChildren<HirScalarExpr> for HirScalarExpr
Source§fn visit_children<F>(&self, f: F)where
F: FnMut(&Self),
fn visit_children<F>(&self, f: F)where
F: FnMut(&Self),
f to each direct child.Source§fn visit_mut_children<F>(&mut self, f: F)where
F: FnMut(&mut Self),
fn visit_mut_children<F>(&mut self, f: F)where
F: FnMut(&mut Self),
f to each direct child.Source§impl VisitChildren<HirScalarExpr> for ValueWindowExpr
impl VisitChildren<HirScalarExpr> for ValueWindowExpr
Source§fn visit_children<F>(&self, f: F)where
F: FnMut(&HirScalarExpr),
fn visit_children<F>(&self, f: F)where
F: FnMut(&HirScalarExpr),
f to each direct child.Source§fn visit_mut_children<F>(&mut self, f: F)where
F: FnMut(&mut HirScalarExpr),
fn visit_mut_children<F>(&mut self, f: F)where
F: FnMut(&mut HirScalarExpr),
f to each direct child.Source§fn try_visit_children<F, E>(&self, f: F) -> Result<(), E>
fn try_visit_children<F, E>(&self, f: F) -> Result<(), E>
f to each direct child. Read moreSource§impl VisitChildren<HirScalarExpr> for WindowExpr
impl VisitChildren<HirScalarExpr> for WindowExpr
Source§fn visit_children<F>(&self, f: F)where
F: FnMut(&HirScalarExpr),
fn visit_children<F>(&self, f: F)where
F: FnMut(&HirScalarExpr),
f to each direct child.Source§fn visit_mut_children<F>(&mut self, f: F)where
F: FnMut(&mut HirScalarExpr),
fn visit_mut_children<F>(&mut self, f: F)where
F: FnMut(&mut HirScalarExpr),
f to each direct child.Source§fn try_visit_children<F, E>(&self, f: F) -> Result<(), E>
fn try_visit_children<F, E>(&self, f: F) -> Result<(), E>
f to each direct child. Read moreSource§impl VisitChildren<HirScalarExpr> for WindowExprType
impl VisitChildren<HirScalarExpr> for WindowExprType
Source§fn visit_children<F>(&self, f: F)where
F: FnMut(&HirScalarExpr),
fn visit_children<F>(&self, f: F)where
F: FnMut(&HirScalarExpr),
f to each direct child.Source§fn visit_mut_children<F>(&mut self, f: F)where
F: FnMut(&mut HirScalarExpr),
fn visit_mut_children<F>(&mut self, f: F)where
F: FnMut(&mut HirScalarExpr),
f to each direct child.Source§fn try_visit_children<F, E>(&self, f: F) -> Result<(), E>
fn try_visit_children<F, E>(&self, f: F) -> Result<(), E>
f to each direct child. Read moreimpl Eq for HirScalarExpr
impl StructuralPartialEq for HirScalarExpr
Auto Trait Implementations§
impl Freeze for HirScalarExpr
impl RefUnwindSafe for HirScalarExpr
impl Send for HirScalarExpr
impl Sync for HirScalarExpr
impl Unpin for HirScalarExpr
impl UnwindSafe for HirScalarExpr
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Comparable<K> for Q
impl<Q, K> Comparable<K> for Q
Source§impl<T> Downcast for T
impl<T> Downcast for T
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
key and return true if they are equal.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
key and return true if they are equal.Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<T> FmtForward for T
impl<T> FmtForward for T
Source§fn fmt_binary(self) -> FmtBinary<Self>where
Self: Binary,
fn fmt_binary(self) -> FmtBinary<Self>where
Self: Binary,
self to use its Binary implementation when Debug-formatted.Source§fn fmt_display(self) -> FmtDisplay<Self>where
Self: Display,
fn fmt_display(self) -> FmtDisplay<Self>where
Self: Display,
self to use its Display implementation when
Debug-formatted.Source§fn fmt_lower_exp(self) -> FmtLowerExp<Self>where
Self: LowerExp,
fn fmt_lower_exp(self) -> FmtLowerExp<Self>where
Self: LowerExp,
self to use its LowerExp implementation when
Debug-formatted.Source§fn fmt_lower_hex(self) -> FmtLowerHex<Self>where
Self: LowerHex,
fn fmt_lower_hex(self) -> FmtLowerHex<Self>where
Self: LowerHex,
self to use its LowerHex implementation when
Debug-formatted.Source§fn fmt_octal(self) -> FmtOctal<Self>where
Self: Octal,
fn fmt_octal(self) -> FmtOctal<Self>where
Self: Octal,
self to use its Octal implementation when Debug-formatted.Source§fn fmt_pointer(self) -> FmtPointer<Self>where
Self: Pointer,
fn fmt_pointer(self) -> FmtPointer<Self>where
Self: Pointer,
self to use its Pointer implementation when
Debug-formatted.Source§fn fmt_upper_exp(self) -> FmtUpperExp<Self>where
Self: UpperExp,
fn fmt_upper_exp(self) -> FmtUpperExp<Self>where
Self: UpperExp,
self to use its UpperExp implementation when
Debug-formatted.Source§fn fmt_upper_hex(self) -> FmtUpperHex<Self>where
Self: UpperHex,
fn fmt_upper_hex(self) -> FmtUpperHex<Self>where
Self: UpperHex,
self to use its UpperHex implementation when
Debug-formatted.Source§impl<T> FutureExt for T
impl<T> FutureExt for T
Source§fn with_context(self, otel_cx: Context) -> WithContext<Self>
fn with_context(self, otel_cx: Context) -> WithContext<Self>
Source§fn with_current_context(self) -> WithContext<Self>
fn with_current_context(self) -> WithContext<Self>
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>
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>
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>
T in a tonic::RequestSource§impl<T, U> OverrideFrom<Option<&T>> for Uwhere
U: OverrideFrom<T>,
impl<T, U> OverrideFrom<Option<&T>> for Uwhere
U: OverrideFrom<T>,
Source§impl<T> Paint for Twhere
T: ?Sized,
impl<T> Paint for Twhere
T: ?Sized,
Source§fn fg(&self, value: Color) -> Painted<&T>
fn fg(&self, value: Color) -> Painted<&T>
Returns a styled value derived from self with the foreground set to
value.
This method should be used rarely. Instead, prefer to use color-specific
builder methods like red() and
green(), which have the same functionality but are
pithier.
§Example
Set foreground color to white using fg():
use yansi::{Paint, Color};
painted.fg(Color::White);Set foreground color to white using white().
use yansi::Paint;
painted.white();Source§fn bright_black(&self) -> Painted<&T>
fn bright_black(&self) -> Painted<&T>
Source§fn bright_red(&self) -> Painted<&T>
fn bright_red(&self) -> Painted<&T>
Source§fn bright_green(&self) -> Painted<&T>
fn bright_green(&self) -> Painted<&T>
Source§fn bright_yellow(&self) -> Painted<&T>
fn bright_yellow(&self) -> Painted<&T>
Source§fn bright_blue(&self) -> Painted<&T>
fn bright_blue(&self) -> Painted<&T>
Source§fn bright_magenta(&self) -> Painted<&T>
fn bright_magenta(&self) -> Painted<&T>
Source§fn bright_cyan(&self) -> Painted<&T>
fn bright_cyan(&self) -> Painted<&T>
Source§fn bright_white(&self) -> Painted<&T>
fn bright_white(&self) -> Painted<&T>
Source§fn bg(&self, value: Color) -> Painted<&T>
fn bg(&self, value: Color) -> Painted<&T>
Returns a styled value derived from self with the background set to
value.
This method should be used rarely. Instead, prefer to use color-specific
builder methods like on_red() and
on_green(), which have the same functionality but
are pithier.
§Example
Set background color to red using fg():
use yansi::{Paint, Color};
painted.bg(Color::Red);Set background color to red using on_red().
use yansi::Paint;
painted.on_red();Source§fn on_primary(&self) -> Painted<&T>
fn on_primary(&self) -> Painted<&T>
Source§fn on_magenta(&self) -> Painted<&T>
fn on_magenta(&self) -> Painted<&T>
Source§fn on_bright_black(&self) -> Painted<&T>
fn on_bright_black(&self) -> Painted<&T>
Source§fn on_bright_red(&self) -> Painted<&T>
fn on_bright_red(&self) -> Painted<&T>
Source§fn on_bright_green(&self) -> Painted<&T>
fn on_bright_green(&self) -> Painted<&T>
Source§fn on_bright_yellow(&self) -> Painted<&T>
fn on_bright_yellow(&self) -> Painted<&T>
Source§fn on_bright_blue(&self) -> Painted<&T>
fn on_bright_blue(&self) -> Painted<&T>
Source§fn on_bright_magenta(&self) -> Painted<&T>
fn on_bright_magenta(&self) -> Painted<&T>
Source§fn on_bright_cyan(&self) -> Painted<&T>
fn on_bright_cyan(&self) -> Painted<&T>
Source§fn on_bright_white(&self) -> Painted<&T>
fn on_bright_white(&self) -> Painted<&T>
Source§fn attr(&self, value: Attribute) -> Painted<&T>
fn attr(&self, value: Attribute) -> Painted<&T>
Enables the styling Attribute value.
This method should be used rarely. Instead, prefer to use
attribute-specific builder methods like bold() and
underline(), which have the same functionality
but are pithier.
§Example
Make text bold using attr():
use yansi::{Paint, Attribute};
painted.attr(Attribute::Bold);Make text bold using using bold().
use yansi::Paint;
painted.bold();Source§fn rapid_blink(&self) -> Painted<&T>
fn rapid_blink(&self) -> Painted<&T>
Source§fn quirk(&self, value: Quirk) -> Painted<&T>
fn quirk(&self, value: Quirk) -> Painted<&T>
Enables the yansi Quirk value.
This method should be used rarely. Instead, prefer to use quirk-specific
builder methods like mask() and
wrap(), which have the same functionality but are
pithier.
§Example
Enable wrapping using .quirk():
use yansi::{Paint, Quirk};
painted.quirk(Quirk::Wrap);Enable wrapping using wrap().
use yansi::Paint;
painted.wrap();Source§fn clear(&self) -> Painted<&T>
👎Deprecated since 1.0.1: renamed to resetting() due to conflicts with Vec::clear().
The clear() method will be removed in a future release.
fn clear(&self) -> Painted<&T>
resetting() due to conflicts with Vec::clear().
The clear() method will be removed in a future release.Source§fn whenever(&self, value: Condition) -> Painted<&T>
fn whenever(&self, value: Condition) -> Painted<&T>
Conditionally enable styling based on whether the Condition value
applies. Replaces any previous condition.
See the crate level docs for more details.
§Example
Enable styling painted only when both stdout and stderr are TTYs:
use yansi::{Paint, Condition};
painted.red().on_yellow().whenever(Condition::STDOUTERR_ARE_TTY);Source§impl<T> Pipe for Twhere
T: ?Sized,
impl<T> Pipe for Twhere
T: ?Sized,
Source§fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> Rwhere
Self: Sized,
fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> Rwhere
Self: Sized,
Source§fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> Rwhere
R: 'a,
fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> Rwhere
R: 'a,
self and passes that borrow into the pipe function. Read moreSource§fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> Rwhere
R: 'a,
fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> Rwhere
R: 'a,
self and passes that borrow into the pipe function. Read moreSource§fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> R
fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> R
Source§fn pipe_borrow_mut<'a, B, R>(
&'a mut self,
func: impl FnOnce(&'a mut B) -> R,
) -> R
fn pipe_borrow_mut<'a, B, R>( &'a mut self, func: impl FnOnce(&'a mut B) -> R, ) -> R
Source§fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> R
fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> R
self, then passes self.as_ref() into the pipe function.Source§fn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> R
fn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> R
self, then passes self.as_mut() into the pipe
function.Source§fn pipe_deref<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> R
fn pipe_deref<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> R
self, then passes self.deref() into the pipe function.Source§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
Source§impl<P, R> ProtoType<R> for Pwhere
R: RustType<P>,
impl<P, R> ProtoType<R> for Pwhere
R: RustType<P>,
Source§fn into_rust(self) -> Result<R, TryFromProtoError>
fn into_rust(self) -> Result<R, TryFromProtoError>
RustType::from_proto.Source§fn from_rust(rust: &R) -> P
fn from_rust(rust: &R) -> P
RustType::into_proto.Source§impl<'a, S, T> Semigroup<&'a S> for Twhere
T: Semigroup<S>,
impl<'a, S, T> Semigroup<&'a S> for Twhere
T: Semigroup<S>,
Source§fn plus_equals(&mut self, rhs: &&'a S)
fn plus_equals(&mut self, rhs: &&'a S)
std::ops::AddAssign, for types that do not implement AddAssign.Source§impl<T> Serialize for T
impl<T> Serialize for T
fn erased_serialize(&self, serializer: &mut dyn Serializer) -> Result<Ok, Error>
Source§impl<T> ServiceExt for T
impl<T> ServiceExt for T
Source§fn map_response_body<F>(self, f: F) -> MapResponseBody<Self, F>where
Self: Sized,
fn map_response_body<F>(self, f: F) -> MapResponseBody<Self, F>where
Self: Sized,
Source§fn decompression(self) -> Decompression<Self>where
Self: Sized,
fn decompression(self) -> Decompression<Self>where
Self: Sized,
Source§fn trace_for_http(self) -> Trace<Self, SharedClassifier<ServerErrorsAsFailures>>where
Self: Sized,
fn trace_for_http(self) -> Trace<Self, SharedClassifier<ServerErrorsAsFailures>>where
Self: Sized,
Source§fn trace_for_grpc(self) -> Trace<Self, SharedClassifier<GrpcErrorsAsFailures>>where
Self: Sized,
fn trace_for_grpc(self) -> Trace<Self, SharedClassifier<GrpcErrorsAsFailures>>where
Self: Sized,
Source§fn follow_redirects(self) -> FollowRedirect<Self>where
Self: Sized,
fn follow_redirects(self) -> FollowRedirect<Self>where
Self: Sized,
Source§impl<T> Tap for T
impl<T> Tap for T
Source§fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Self
fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Self
Borrow<B> of a value. Read moreSource§fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Self
fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Self
BorrowMut<B> of a value. Read moreSource§fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Self
fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Self
AsRef<R> view of a value. Read moreSource§fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Self
fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Self
AsMut<R> view of a value. Read moreSource§fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Self
fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Self
Deref::Target of a value. Read moreSource§fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Self
fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Self
Deref::Target of a value. Read moreSource§fn tap_dbg(self, func: impl FnOnce(&Self)) -> Self
fn tap_dbg(self, func: impl FnOnce(&Self)) -> Self
.tap() only in debug builds, and is erased in release builds.Source§fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self
fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self
.tap_mut() only in debug builds, and is erased in release
builds.Source§fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Self
fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Self
.tap_borrow() only in debug builds, and is erased in release
builds.Source§fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Self
fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Self
.tap_borrow_mut() only in debug builds, and is erased in release
builds.Source§fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Self
fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Self
.tap_ref() only in debug builds, and is erased in release
builds.Source§fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Self
fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Self
.tap_ref_mut() only in debug builds, and is erased in release
builds.Source§fn tap_deref_dbg<T>(self, func: impl FnOnce(&T)) -> Self
fn tap_deref_dbg<T>(self, func: impl FnOnce(&T)) -> Self
.tap_deref() only in debug builds, and is erased in release
builds.Source§impl<T> ToStringFallible for Twhere
T: Display,
impl<T> ToStringFallible for Twhere
T: Display,
Source§fn try_to_string(&self) -> Result<String, TryReserveError>
fn try_to_string(&self) -> Result<String, TryReserveError>
ToString::to_string, but without panic on OOM.
Source§impl<T> Visit for Twhere
T: VisitChildren<T>,
impl<T> Visit for Twhere
T: VisitChildren<T>,
Source§fn visit_post<F>(&self, f: &mut F) -> Result<(), RecursionLimitError>
fn visit_post<F>(&self, f: &mut F) -> Result<(), RecursionLimitError>
self.Source§fn visit_post_nolimit<F>(&self, f: &mut F)
fn visit_post_nolimit<F>(&self, f: &mut F)
visit_post instead.self.
Does not enforce a recursion limit.Source§fn visit_mut_post<F>(&mut self, f: &mut F) -> Result<(), RecursionLimitError>
fn visit_mut_post<F>(&mut self, f: &mut F) -> Result<(), RecursionLimitError>
self.Source§fn visit_mut_post_nolimit<F>(&mut self, f: &mut F)
fn visit_mut_post_nolimit<F>(&mut self, f: &mut F)
visit_mut_post instead.self.
Does not enforce a recursion limit.Source§fn try_visit_post<F, E>(&self, f: &mut F) -> Result<(), E>
fn try_visit_post<F, E>(&self, f: &mut F) -> Result<(), E>
self.Source§fn try_visit_mut_post<F, E>(&mut self, f: &mut F) -> Result<(), E>
fn try_visit_mut_post<F, E>(&mut self, f: &mut F) -> Result<(), E>
self.Source§fn visit_pre<F>(&self, f: &mut F) -> Result<(), RecursionLimitError>
fn visit_pre<F>(&self, f: &mut F) -> Result<(), RecursionLimitError>
self.Source§fn visit_pre_with_context<Context, AccFun, Visitor>(
&self,
init: Context,
acc_fun: &mut AccFun,
visitor: &mut Visitor,
) -> Result<(), RecursionLimitError>
fn visit_pre_with_context<Context, AccFun, Visitor>( &self, init: Context, acc_fun: &mut AccFun, visitor: &mut Visitor, ) -> Result<(), RecursionLimitError>
self, which also accumulates context
information along the path from the root to the current node’s parent.
acc_fun is a similar closure as in fold. The accumulated context is passed to the
visitor, along with the current node. Read moreSource§fn visit_pre_nolimit<F>(&self, f: &mut F)
fn visit_pre_nolimit<F>(&self, f: &mut F)
visit_pre instead.self.
Does not enforce a recursion limit.Source§fn visit_mut_pre<F>(&mut self, f: &mut F) -> Result<(), RecursionLimitError>
fn visit_mut_pre<F>(&mut self, f: &mut F) -> Result<(), RecursionLimitError>
self.Source§fn visit_mut_pre_nolimit<F>(&mut self, f: &mut F)
fn visit_mut_pre_nolimit<F>(&mut self, f: &mut F)
visit_mut_pre instead.self.
Does not enforce a recursion limit.Source§fn try_visit_pre<F, E>(&self, f: &mut F) -> Result<(), E>
fn try_visit_pre<F, E>(&self, f: &mut F) -> Result<(), E>
self.Source§fn try_visit_mut_pre<F, E>(&mut self, f: &mut F) -> Result<(), E>
fn try_visit_mut_pre<F, E>(&mut self, f: &mut F) -> Result<(), E>
self.Source§fn visit_pre_post<F1, F2>(
&self,
pre: &mut F1,
post: &mut F2,
) -> Result<(), RecursionLimitError>
fn visit_pre_post<F1, F2>( &self, pre: &mut F1, post: &mut F2, ) -> Result<(), RecursionLimitError>
Source§fn visit_pre_post_nolimit<F1, F2>(&self, pre: &mut F1, post: &mut F2)
fn visit_pre_post_nolimit<F1, F2>(&self, pre: &mut F1, post: &mut F2)
visit instead.Visit::visit_pre and Visit::visit_post.
Does not enforce a recursion limit. Read moreSource§fn visit_mut_pre_post<F1, F2>(
&mut self,
pre: &mut F1,
post: &mut F2,
) -> Result<(), RecursionLimitError>
fn visit_mut_pre_post<F1, F2>( &mut self, pre: &mut F1, post: &mut F2, ) -> Result<(), RecursionLimitError>
visit_mut instead.Source§fn visit_mut_pre_post_nolimit<F1, F2>(&mut self, pre: &mut F1, post: &mut F2)
fn visit_mut_pre_post_nolimit<F1, F2>(&mut self, pre: &mut F1, post: &mut F2)
visit_mut_pre_post instead.Visit::visit_mut_pre and Visit::visit_mut_post.
Does not enforce a recursion limit. Read more