pub struct Session<T = Timestamp>{Show 19 fields
conn_id: ConnectionId,
uuid: Uuid,
prepared_statements: BTreeMap<String, PreparedStatement>,
portals: BTreeMap<String, Portal>,
transaction: TransactionStatus<T>,
pcx: Option<PlanContext>,
metrics: SessionMetrics,
builtin_updates: Option<Pin<Box<dyn Future<Output = ()> + Send + Sync + 'static>>>,
role_metadata: Option<RoleMetadata>,
client_ip: Option<IpAddr>,
vars: SessionVars,
notices_tx: UnboundedSender<AdapterNotice>,
notices_rx: UnboundedReceiver<AdapterNotice>,
next_transaction_id: TransactionId,
secret_key: u32,
external_metadata_rx: Option<Receiver<ExternalUserMetadata>>,
qcell_owner: QCellOwner,
session_oracles: BTreeMap<Timeline, InMemoryTimestampOracle<T, NowFn<T>>>,
state_revision: u64,
}Expand description
A session holds per-connection state.
Fields§
§conn_id: ConnectionId§uuid: UuidA globally unique identifier for the session. Not to be confused
with conn_id, which may be reused.
prepared_statements: BTreeMap<String, PreparedStatement>§portals: BTreeMap<String, Portal>§transaction: TransactionStatus<T>§pcx: Option<PlanContext>§metrics: SessionMetrics§builtin_updates: Option<Pin<Box<dyn Future<Output = ()> + Send + Sync + 'static>>>§role_metadata: Option<RoleMetadata>The role metadata of the current session.
Invariant: role_metadata must be Some after the user has
successfully connected to and authenticated with Materialize.
Prefer using this value over SessionConfig::user.
client_ip: Option<IpAddr>§vars: SessionVars§notices_tx: UnboundedSender<AdapterNotice>§notices_rx: UnboundedReceiver<AdapterNotice>§next_transaction_id: TransactionId§secret_key: u32§external_metadata_rx: Option<Receiver<ExternalUserMetadata>>§qcell_owner: QCellOwner§session_oracles: BTreeMap<Timeline, InMemoryTimestampOracle<T, NowFn<T>>>§state_revision: u64Incremented when session state that is relevant to prepared statement planning changes.
Currently, only changes to portals are tracked. Changes to prepared_statements don’t
need to be tracked, because prepared statements can’t depend on other prepared statements.
TODO: We might want to track changes also to session variables.
(Catalog::transient_revision similarly tracks changes on the catalog side.)
Implementations§
Source§impl<T: TimestampManipulation> Session<T>
impl<T: TimestampManipulation> Session<T>
Sourcepub(crate) fn new(
build_info: &'static BuildInfo,
config: SessionConfig,
metrics: SessionMetrics,
) -> Session<T>
pub(crate) fn new( build_info: &'static BuildInfo, config: SessionConfig, metrics: SessionMetrics, ) -> Session<T>
Creates a new session for the specified connection ID.
Sourcepub fn meta(&self) -> SessionMeta
pub fn meta(&self) -> SessionMeta
Returns a reference-less collection of data usable by other tasks that don’t have ownership of the Session.
Sourcepub(crate) fn mint_logging<A: AstInfo>(
&self,
raw_sql: String,
stmt: Option<&Statement<A>>,
now: EpochMillis,
) -> Arc<QCell<PreparedStatementLoggingInfo>>
pub(crate) fn mint_logging<A: AstInfo>( &self, raw_sql: String, stmt: Option<&Statement<A>>, now: EpochMillis, ) -> Arc<QCell<PreparedStatementLoggingInfo>>
Creates new statement logging metadata for a one-off statement.
pub(crate) fn qcell_rw<'a, T2: 'a>( &'a mut self, cell: &'a Arc<QCell<T2>>, ) -> &'a mut T2
Sourcepub fn uuid(&self) -> Uuid
pub fn uuid(&self) -> Uuid
Returns a unique ID for the session.
Not to be confused with connection_id, which can be reused.
Sourcepub fn dummy() -> Session<T>
pub fn dummy() -> Session<T>
Creates a new dummy session.
Dummy sessions are intended for use when executing queries on behalf of the system itself, rather than on behalf of a user.
fn new_internal( build_info: &'static BuildInfo, _: SessionConfig, metrics: SessionMetrics, ) -> Session<T>
Sourcepub fn secret_key(&self) -> u32
pub fn secret_key(&self) -> u32
Returns the secret key associated with the session.
fn new_pcx(&self, wall_time: DateTime<Utc>) -> PlanContext
Sourcepub fn start_transaction(
&mut self,
wall_time: DateTime<Utc>,
access: Option<TransactionAccessMode>,
isolation_level: Option<TransactionIsolationLevel>,
) -> Result<(), AdapterError>
pub fn start_transaction( &mut self, wall_time: DateTime<Utc>, access: Option<TransactionAccessMode>, isolation_level: Option<TransactionIsolationLevel>, ) -> Result<(), AdapterError>
Starts an explicit transaction, or changes an implicit to an explicit transaction.
Sourcepub fn start_transaction_implicit(
&mut self,
wall_time: DateTime<Utc>,
stmts: usize,
)
pub fn start_transaction_implicit( &mut self, wall_time: DateTime<Utc>, stmts: usize, )
Starts either a single statement or implicit transaction based on the number of statements, but only if no transaction has been started already.
Sourcepub fn start_transaction_single_stmt(&mut self, wall_time: DateTime<Utc>)
pub fn start_transaction_single_stmt(&mut self, wall_time: DateTime<Utc>)
Starts a single statement transaction, but only if no transaction has been started already.
Sourcepub fn clear_transaction(&mut self) -> TransactionStatus<T>
pub fn clear_transaction(&mut self) -> TransactionStatus<T>
Clears a transaction, setting its state to Default and destroying all portals. Returned are:
- sinks that were started in this transaction and need to be dropped
- the cleared transaction so its operations can be handled
The Postgres protocol docs specify:
a named portal object lasts till the end of the current transaction and An unnamed portal is destroyed at the end of the transaction
Sourcepub fn fail_transaction(self) -> Self
pub fn fail_transaction(self) -> Self
Marks the current transaction as failed.
Sourcepub fn transaction(&self) -> &TransactionStatus<T>
pub fn transaction(&self) -> &TransactionStatus<T>
Returns the current transaction status.
Sourcepub fn transaction_mut(&mut self) -> &mut TransactionStatus<T>
pub fn transaction_mut(&mut self) -> &mut TransactionStatus<T>
Returns the current transaction status.
Sourcepub fn transaction_code(&self) -> TransactionCode
pub fn transaction_code(&self) -> TransactionCode
Returns the session’s transaction code.
Sourcepub fn add_transaction_ops(
&mut self,
add_ops: TransactionOps<T>,
) -> Result<(), AdapterError>
pub fn add_transaction_ops( &mut self, add_ops: TransactionOps<T>, ) -> Result<(), AdapterError>
Adds operations to the current transaction. An error is produced if they cannot be merged (i.e., a timestamp-dependent read cannot be merged to an insert).
Sourcepub fn retain_notice_transmitter(&self) -> UnboundedSender<AdapterNotice>
pub fn retain_notice_transmitter(&self) -> UnboundedSender<AdapterNotice>
Returns a channel on which to send notices to the session.
Sourcepub fn add_notice(&self, notice: AdapterNotice)
pub fn add_notice(&self, notice: AdapterNotice)
Adds a notice to the session.
Sourcepub fn add_notices(&self, notices: impl IntoIterator<Item = AdapterNotice>)
pub fn add_notices(&self, notices: impl IntoIterator<Item = AdapterNotice>)
Adds multiple notices to the session.
Sourcepub async fn recv_notice(&mut self) -> AdapterNotice
pub async fn recv_notice(&mut self) -> AdapterNotice
Awaits a possible notice.
This method is cancel safe.
Sourcepub fn drain_notices(&mut self) -> Vec<AdapterNotice>
pub fn drain_notices(&mut self) -> Vec<AdapterNotice>
Returns a draining iterator over the notices attached to the session.
Sourcefn notice_filter(&self, notice: AdapterNotice) -> Option<AdapterNotice>
fn notice_filter(&self, notice: AdapterNotice) -> Option<AdapterNotice>
Returns Some if the notice should be reported, otherwise None.
Sourcepub fn clear_transaction_ops(&mut self)
pub fn clear_transaction_ops(&mut self)
Sets the transaction ops to TransactionOps::None. Must only be used after
verifying that no transaction anomalies will occur if cleared.
Sourcepub fn take_transaction_timestamp_context(
&mut self,
) -> Option<TimestampContext<T>>
pub fn take_transaction_timestamp_context( &mut self, ) -> Option<TimestampContext<T>>
If the current transaction ops belong to a read, then sets the
ops to None, returning the old read timestamp context if
any existed. Must only be used after verifying that no transaction
anomalies will occur if cleared.
Sourcepub fn get_transaction_timestamp_determination(
&self,
) -> Option<TimestampDetermination<T>>
pub fn get_transaction_timestamp_determination( &self, ) -> Option<TimestampDetermination<T>>
Returns the transaction’s read timestamp determination, if set.
Returns None if there is no active transaction, or if the active
transaction is not a read transaction.
Sourcepub fn contains_read_timestamp(&self) -> bool
pub fn contains_read_timestamp(&self) -> bool
Whether this session has a timestamp for a read transaction.
Sourcepub fn set_prepared_statement(
&mut self,
name: String,
stmt: Option<Statement<Raw>>,
raw_sql: String,
desc: StatementDesc,
state_revision: StateRevision,
now: EpochMillis,
)
pub fn set_prepared_statement( &mut self, name: String, stmt: Option<Statement<Raw>>, raw_sql: String, desc: StatementDesc, state_revision: StateRevision, now: EpochMillis, )
Registers the prepared statement under name.
Sourcepub fn remove_prepared_statement(&mut self, name: &str) -> bool
pub fn remove_prepared_statement(&mut self, name: &str) -> bool
Removes the prepared statement associated with name.
Returns whether a statement previously existed.
Sourcepub fn remove_all_prepared_statements(&mut self)
pub fn remove_all_prepared_statements(&mut self)
Removes all prepared statements.
Sourcepub fn get_prepared_statement_unverified(
&self,
name: &str,
) -> Option<&PreparedStatement>
pub fn get_prepared_statement_unverified( &self, name: &str, ) -> Option<&PreparedStatement>
Retrieves the prepared statement associated with name.
This is unverified and could be incorrect if the underlying catalog has changed.
Sourcepub fn get_prepared_statement_mut_unverified(
&mut self,
name: &str,
) -> Option<&mut PreparedStatement>
pub fn get_prepared_statement_mut_unverified( &mut self, name: &str, ) -> Option<&mut PreparedStatement>
Retrieves the prepared statement associated with name.
This is unverified and could be incorrect if the underlying catalog has changed.
Sourcepub fn prepared_statements(&self) -> &BTreeMap<String, PreparedStatement>
pub fn prepared_statements(&self) -> &BTreeMap<String, PreparedStatement>
Returns the prepared statements for the session.
Sourcepub fn set_portal(
&mut self,
portal_name: String,
desc: StatementDesc,
stmt: Option<Statement<Raw>>,
logging: Arc<QCell<PreparedStatementLoggingInfo>>,
params: Vec<(Datum<'_>, SqlScalarType)>,
result_formats: Vec<Format>,
state_revision: StateRevision,
) -> Result<(), AdapterError>
pub fn set_portal( &mut self, portal_name: String, desc: StatementDesc, stmt: Option<Statement<Raw>>, logging: Arc<QCell<PreparedStatementLoggingInfo>>, params: Vec<(Datum<'_>, SqlScalarType)>, result_formats: Vec<Format>, state_revision: StateRevision, ) -> Result<(), AdapterError>
Binds the specified portal to the specified prepared statement.
If the prepared statement contains parameters, the values and types of
those parameters must be provided in params. It is the caller’s
responsibility to ensure that the correct number of parameters is
provided.
The results_formats parameter sets the desired format of the results,
and is stored on the portal.
Sourcepub fn remove_portal(&mut self, portal_name: &str) -> bool
pub fn remove_portal(&mut self, portal_name: &str) -> bool
Removes the specified portal.
If there is no such portal, this method does nothing. Returns whether that portal existed.
Sourcepub fn get_portal_unverified(&self, portal_name: &str) -> Option<&Portal>
pub fn get_portal_unverified(&self, portal_name: &str) -> Option<&Portal>
Retrieves a reference to the specified portal.
If there is no such portal, returns None.
Sourcepub fn get_portal_unverified_mut(
&mut self,
portal_name: &str,
) -> Option<PortalRefMut<'_>>
pub fn get_portal_unverified_mut( &mut self, portal_name: &str, ) -> Option<PortalRefMut<'_>>
Retrieves a mutable reference to the specified portal.
If there is no such portal, returns None.
Note: When using the returned PortalRefMut, there is no need to increment
Session::state_revision, because the portal’s meaning is not changed.
Sourcepub fn create_new_portal(
&mut self,
stmt: Option<Statement<Raw>>,
logging: Arc<QCell<PreparedStatementLoggingInfo>>,
desc: StatementDesc,
parameters: Params,
result_formats: Vec<Format>,
state_revision: StateRevision,
) -> Result<String, AdapterError>
pub fn create_new_portal( &mut self, stmt: Option<Statement<Raw>>, logging: Arc<QCell<PreparedStatementLoggingInfo>>, desc: StatementDesc, parameters: Params, result_formats: Vec<Format>, state_revision: StateRevision, ) -> Result<String, AdapterError>
Creates and installs a new portal.
Sourcepub fn reset(&mut self)
pub fn reset(&mut self)
Resets the session to its initial state. Returns sinks that need to be dropped.
Sourcepub fn application_name(&self) -> &str
pub fn application_name(&self) -> &str
Returns the application_name that created this session.
Sourcepub fn vars(&self) -> &SessionVars
pub fn vars(&self) -> &SessionVars
Returns a reference to the variables in this session.
Sourcepub fn vars_mut(&mut self) -> &mut SessionVars
pub fn vars_mut(&mut self) -> &mut SessionVars
Returns a mutable reference to the variables in this session.
Sourcepub fn try_grant_write_locks(
&mut self,
guards: WriteLocks,
) -> Result<(), &WriteLocks>
pub fn try_grant_write_locks( &mut self, guards: WriteLocks, ) -> Result<(), &WriteLocks>
Grants a set of write locks to this session’s inner Transaction.
§Panics
If the inner transaction is idle. See TransactionStatus::try_grant_write_locks.
Sourcepub fn apply_external_metadata_updates(&mut self)
pub fn apply_external_metadata_updates(&mut self)
Drains any external metadata updates and applies the changes from the latest update.
Sourcepub fn initialize_role_metadata(&mut self, role_id: RoleId)
pub fn initialize_role_metadata(&mut self, role_id: RoleId)
Initializes the session’s role metadata.
Sourcepub fn ensure_timestamp_oracle(
&mut self,
timeline: Timeline,
) -> &mut InMemoryTimestampOracle<T, NowFn<T>>
pub fn ensure_timestamp_oracle( &mut self, timeline: Timeline, ) -> &mut InMemoryTimestampOracle<T, NowFn<T>>
Ensures that a timestamp oracle exists for timeline and returns a mutable reference to
the timestamp oracle.
Sourcepub fn ensure_local_timestamp_oracle(
&mut self,
) -> &mut InMemoryTimestampOracle<T, NowFn<T>>
pub fn ensure_local_timestamp_oracle( &mut self, ) -> &mut InMemoryTimestampOracle<T, NowFn<T>>
Ensures that a timestamp oracle exists for reads and writes from/to a local input and returns a mutable reference to the timestamp oracle.
Sourcepub fn get_timestamp_oracle(
&self,
timeline: &Timeline,
) -> Option<&InMemoryTimestampOracle<T, NowFn<T>>>
pub fn get_timestamp_oracle( &self, timeline: &Timeline, ) -> Option<&InMemoryTimestampOracle<T, NowFn<T>>>
Returns a reference to the timestamp oracle for timeline.
Sourcepub fn apply_write(&mut self, timestamp: T)
pub fn apply_write(&mut self, timestamp: T)
If the current session is using the Strong Session Serializable isolation level advance the
session local timestamp oracle to write_ts.
Sourcepub fn metrics(&self) -> &SessionMetrics
pub fn metrics(&self) -> &SessionMetrics
Returns the SessionMetrics instance associated with this Session.
Sourcepub fn set_builtin_table_updates(
&mut self,
fut: Pin<Box<dyn Future<Output = ()> + Send + Sync + 'static>>,
)
pub fn set_builtin_table_updates( &mut self, fut: Pin<Box<dyn Future<Output = ()> + Send + Sync + 'static>>, )
Sets the BuiltinTableAppendNotify for this session.
Sourcepub fn clear_builtin_table_updates(
&mut self,
) -> Option<impl Future<Output = ()> + 'static>
pub fn clear_builtin_table_updates( &mut self, ) -> Option<impl Future<Output = ()> + 'static>
Takes the stashed BuiltinTableAppendNotify, if one exists, and returns a Future that
waits for the writes to complete.
Sourcepub fn state_revision(&self) -> u64
pub fn state_revision(&self) -> u64
Return the state_revision of the session, which can be used by dependent objects for knowing when to re-plan due to session state changes.
Trait Implementations§
Source§impl<T> SessionMetadata for Session<T>
impl<T> SessionMetadata for Session<T>
Source§fn conn_id(&self) -> &ConnectionId
fn conn_id(&self) -> &ConnectionId
Source§fn client_ip(&self) -> Option<&IpAddr>
fn client_ip(&self) -> Option<&IpAddr>
Source§fn pcx(&self) -> &PlanContext
fn pcx(&self) -> &PlanContext
Source§fn role_metadata(&self) -> &RoleMetadata
fn role_metadata(&self) -> &RoleMetadata
Source§fn vars(&self) -> &SessionVars
fn vars(&self) -> &SessionVars
Source§fn current_role_id(&self) -> &RoleId
fn current_role_id(&self) -> &RoleId
Source§fn session_role_id(&self) -> &RoleId
fn session_role_id(&self) -> &RoleId
fn user(&self) -> &User
fn database(&self) -> &str
fn search_path(&self) -> &[Ident]
fn is_superuser(&self) -> bool
fn enable_session_rbac_checks(&self) -> bool
Auto Trait Implementations§
impl<T> Freeze for Session<T>where
T: Freeze,
impl<T = Timestamp> !RefUnwindSafe for Session<T>
impl<T> Send for Session<T>
impl<T> Sync for Session<T>
impl<T> Unpin for Session<T>where
T: Unpin,
impl<T = Timestamp> !UnwindSafe for Session<T>
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> Downcast for T
impl<T> Downcast for T
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> 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.