pub struct Context { /* private fields */ }
Expand description
Context contains Node state and references to the runtime.
Implementations§
Source§impl Context
impl Context
Sourcepub fn primary_address(&self) -> &Address
pub fn primary_address(&self) -> &Address
Return the primary address of the current worker
Sourcepub fn additional_addresses(&self) -> impl Iterator<Item = &Address>
pub fn additional_addresses(&self) -> impl Iterator<Item = &Address>
Return additional addresses of the current worker
Sourcepub fn flow_controls(&self) -> &FlowControls
pub fn flow_controls(&self) -> &FlowControls
Shared FlowControls
instance
Sourcepub fn tracing_context(&self) -> OpenTelemetryContext
pub fn tracing_context(&self) -> OpenTelemetryContext
Return the tracing context
Sourcepub fn set_tracing_context(&mut self, tracing_context: OpenTelemetryContext)
pub fn set_tracing_context(&mut self, tracing_context: OpenTelemetryContext)
Set the current tracing context
Source§impl Context
impl Context
Sourcepub fn list_workers(&self) -> Result<Vec<Address>, Error>
pub fn list_workers(&self) -> Result<Vec<Address>, Error>
Return a list of all available worker addresses on a node
Sourcepub fn is_worker_registered_at(&self, address: &Address) -> Result<bool, Error>
pub fn is_worker_registered_at(&self, address: &Address) -> Result<bool, Error>
Return true if a worker is already registered at this address
Sourcepub fn find_terminal_address<'a>(
&self,
addresses: impl Iterator<Item = &'a Address>,
) -> Result<Option<(&'a Address, AddressMetadata)>, Error>
pub fn find_terminal_address<'a>( &self, addresses: impl Iterator<Item = &'a Address>, ) -> Result<Option<(&'a Address, AddressMetadata)>, Error>
Finds the terminal address of a route, if present
Sourcepub fn get_metadata(
&self,
address: &Address,
) -> Result<Option<AddressMetadata>, Error>
pub fn get_metadata( &self, address: &Address, ) -> Result<Option<AddressMetadata>, Error>
Read metadata for the provided address
Source§impl Context
impl Context
Sourcepub fn new_detached_with_mailboxes(
&self,
mailboxes: Mailboxes,
) -> Result<Context, Error>
pub fn new_detached_with_mailboxes( &self, mailboxes: Mailboxes, ) -> Result<Context, Error>
TODO basically we can just rename Self::new_detached_impl()
Sourcepub fn new_detached(
&self,
address: impl Into<Address>,
incoming: impl IncomingAccessControl,
outgoing: impl OutgoingAccessControl,
) -> Result<Context, Error>
pub fn new_detached( &self, address: impl Into<Address>, incoming: impl IncomingAccessControl, outgoing: impl OutgoingAccessControl, ) -> Result<Context, Error>
Create a new detached Context
without spawning a full worker
Note: this function is very low-level. For most users
start_worker()
is the recommended way
to create a new worker context.
Approximate flow of starting a detached address:
- Create and Spawn AsyncDrop::run
- StartWorker message -> Router
- First address is considered a primary_addr (main_addr)
- Check if router.map.address_records_map already has primary_addr
- AddressRecord is created and inserted in router.map
- Iterate over metadata: Check if it belongs to that record Set is_terminal true in router.map.address_metadata_map (if address is terminal) Insert attributes one by one
- For each address we insert pair (Address, primary_addr) into router.map.alias_map, including (primary_addr, primary_addr itself)
Approximate flow of stopping a detached address:
- Context::Drop is called when Context is dropped by rust runtime (according to RAII principle)
- async_drop_sender is used to send the Context address
- AsyncDrop sends StopWorker message -> Router
- Get AddressRecord
- router.map.free_address(main_address) is called (given Router state is running): remote main_address from router.map.stopping (it’s not their anyway, unless in was a cluster and node was shutting down) Remove AddressRecord from router.map.address_records_map (return error if not found) Remove all alias in router.map.alias_map Remote all meta from router.map.address_metadata
Source§impl Context
impl Context
Sourcepub async fn receive<M>(&mut self) -> Result<Routed<M>, Error>where
M: Message,
pub async fn receive<M>(&mut self) -> Result<Routed<M>, Error>where
M: Message,
Block the current worker to wait for a typed message
This function may return a Err(FailedLoadData)
if the
underlying worker was shut down, or Err(Timeout)
if the call
was waiting for longer than the default timeout
.
Use receive_extended()
to use a specific timeout period.
Will return None
if the corresponding worker has been
stopped, or the underlying Node has shut down.
Sourcepub async fn receive_extended<M>(
&mut self,
options: MessageReceiveOptions,
) -> Result<Routed<M>, Error>where
M: Message,
pub async fn receive_extended<M>(
&mut self,
options: MessageReceiveOptions,
) -> Result<Routed<M>, Error>where
M: Message,
Wait to receive a typed message
Source§impl Context
impl Context
Sourcepub async fn send_and_receive<T, R>(
&self,
route: impl Into<Route>,
msg: T,
) -> Result<R, Error>
pub async fn send_and_receive<T, R>( &self, route: impl Into<Route>, msg: T, ) -> Result<R, Error>
Using a temporary new context, send a message and then receive a message with default timeout and no flow control
This helper function uses new_detached
, send
, and
receive
internally. See their documentation for more
details.
Sourcepub async fn send_and_receive_extended<T, R>(
&self,
route: impl Into<Route>,
msg: T,
options: MessageSendReceiveOptions,
) -> Result<Routed<R>, Error>
pub async fn send_and_receive_extended<T, R>( &self, route: impl Into<Route>, msg: T, options: MessageSendReceiveOptions, ) -> Result<Routed<R>, Error>
Using a temporary new context, send a message and then receive a message
This helper function uses new_detached
, send
, and
receive
internally. See their documentation for more
details.
Sourcepub async fn send_to_self<A, M>(
&self,
from: A,
addr: A,
msg: M,
) -> Result<(), Error>
pub async fn send_to_self<A, M>( &self, from: A, addr: A, msg: M, ) -> Result<(), Error>
Send a message to another address associated with this worker
This function is a simple wrapper around Self::send()
which
validates the address given to it and will reject invalid
addresses.
Sourcepub async fn send<R, M>(&self, route: R, msg: M) -> Result<(), Error>
pub async fn send<R, M>(&self, route: R, msg: M) -> Result<(), Error>
Send a message to an address or via a fully-qualified route
Routes can be constructed from a set of Address
es, or via
the RouteBuilder
type. Routes can contain middleware
router addresses, which will re-address messages that need to
be handled by specific domain workers.
use ockam_core::{deserialize, serialize, Decodable, Encodable, Encoded};
async fn test(ctx: &mut Context) -> Result<()> {
use ockam_core::Message;
use serde::{Serialize, Deserialize};
#[derive(Message, Serialize, Deserialize)]
struct MyMessage(String);
impl MyMessage {
fn new(s: &str) -> Self {
Self(s.into())
}
}
impl Encodable for MyMessage {
fn encode(self) -> Result<Encoded> {
Ok(serialize(self)?)
}
}
impl Decodable for MyMessage {
fn decode(e: &[u8]) -> Result<Self> {
Ok(deserialize(e)?)
}
}
ctx.send("my-test-worker", MyMessage::new("Hello you there :)")).await?;
Ok(())
Sourcepub async fn send_with_local_info<R, M>(
&self,
route: R,
msg: M,
local_info: Vec<LocalInfo>,
) -> Result<(), Error>
pub async fn send_with_local_info<R, M>( &self, route: R, msg: M, local_info: Vec<LocalInfo>, ) -> Result<(), Error>
Send a message to an address or via a fully-qualified route
after attaching the given LocalInfo
to the message.
Sourcepub async fn send_from_address<R, M>(
&self,
route: R,
msg: M,
sending_address: Address,
) -> Result<(), Error>
pub async fn send_from_address<R, M>( &self, route: R, msg: M, sending_address: Address, ) -> Result<(), Error>
Send a message to an address or via a fully-qualified route
Routes can be constructed from a set of Address
es, or via
the RouteBuilder
type. Routes can contain middleware
router addresses, which will re-address messages that need to
be handled by specific domain workers.
This function additionally takes the sending address parameter, to specify which of a worker’s (or processor’s) addresses should be used.
Sourcepub async fn forward(&self, local_msg: LocalMessage) -> Result<(), Error>
pub async fn forward(&self, local_msg: LocalMessage) -> Result<(), Error>
Forward a transport message to its next routing destination
Similar to Context::send
, but taking a
LocalMessage
, which contains the full destination
route, and calculated return route for this hop.
Note: you most likely want to use
Context::send
instead, unless you are writing an
external router implementation for ockam node.
Sourcepub async fn forward_from_address(
&self,
local_msg: LocalMessage,
sending_address: Address,
) -> Result<(), Error>
pub async fn forward_from_address( &self, local_msg: LocalMessage, sending_address: Address, ) -> Result<(), Error>
Forward a transport message to its next routing destination
Similar to Context::send
, but taking a
LocalMessage
, which contains the full destination
route, and calculated return route for this hop.
Note: you most likely want to use
Context::send
instead, unless you are writing an
external router implementation for ockam node.
Source§impl Context
impl Context
Sourcepub async fn shutdown_node(&self) -> Result<(), Error>
pub async fn shutdown_node(&self) -> Result<(), Error>
Signal to the local runtime to shut down
This call will hang until a safe shutdown has been completed.
The default timeout for a safe shutdown is 1 second. You can
change this behaviour by calling
Context::shutdown_node_with_timeout
directly.
Source§impl Context
impl Context
Sourcepub fn register_transport(&self, transport: Arc<dyn Transport>)
pub fn register_transport(&self, transport: Arc<dyn Transport>)
Return the list of supported transports
Sourcepub fn get_transport(
&self,
transport_type: TransportType,
) -> Option<Arc<dyn Transport>>
pub fn get_transport( &self, transport_type: TransportType, ) -> Option<Arc<dyn Transport>>
Return a transport by type
Sourcepub fn is_transport_registered(&self, transport_type: TransportType) -> bool
pub fn is_transport_registered(&self, transport_type: TransportType) -> bool
Return true if a given transport has already been registered
Sourcepub async fn resolve_transport_route(
&self,
route: Route,
) -> Result<Route, Error>
pub async fn resolve_transport_route( &self, route: Route, ) -> Result<Route, Error>
For each address handled by a given transport in a route, for example, (TCP, “127.0.0.1:4000”) Create a worker supporting the routing of messages for this transport and replace the address in the route with the worker address
Sourcepub async fn resolve_transport_route_static(
route: Route,
transports: HashMap<TransportType, Arc<dyn Transport>>,
) -> Result<(Route, Option<Address>), Error>
pub async fn resolve_transport_route_static( route: Route, transports: HashMap<TransportType, Arc<dyn Transport>>, ) -> Result<(Route, Option<Address>), Error>
For each address handled by a given transport in a route, for example, (TCP, “127.0.0.1:4000”) Create a worker supporting the routing of messages for this transport and replace the address in the route with the worker address. Also, returns the connection worker address, if that connection was instantiated in this function.
Source§impl Context
impl Context
Sourcepub fn start_worker<W>(
&self,
address: impl Into<Address>,
worker: W,
) -> Result<(), Error>
pub fn start_worker<W>( &self, address: impl Into<Address>, worker: W, ) -> Result<(), Error>
Start a new worker instance at the given address. Default AccessControl is AllowAll
A worker is an asynchronous piece of code that can send and
receive messages of a specific type. This type is encoded via
the Worker
trait. If your code relies
on a manual run-loop you may want to use
start_processor()
instead!
Each address in the set must be unique and unused on the
current node. Workers must implement the Worker trait and be
thread-safe. Workers run asynchronously and will be scheduled
independently of each other. To wait for the initialisation
of your worker to complete you can use
wait_for()
.
use ockam_core::{Result, Worker, worker};
use ockam_node::Context;
struct MyWorker;
#[worker]
impl Worker for MyWorker {
type Context = Context;
type Message = String;
}
fn start_my_worker(ctx: &mut Context) -> Result<()> {
ctx.start_worker("my-worker-address", MyWorker)
}
Approximate flow of starting a worker:
- StartWorker message -> Router
- First address is considered a primary_addr (main_addr)
- Check if router.map.address_records_map already has primary_addr
- AddressRecord is created and inserted in router.map
- Iterate over metadata: Check if it belongs to that record Set is_terminal true in router.map.address_metadata_map (if address is terminal) Insert attributes one by one
- For each address we insert pair (Address, primary_addr) into router.map.alias_map, including (primary_addr, primary_addr itself)
- WorkerRelay is spawned as a tokio task: WorkerRelay calls initialize WorkerRelay calls Worker::handle_message for each message until either stop signal is received (CtrlSignal::InterruptStop to AddressRecord::ctrl_tx) there are no messages coming to that receiver (the sender side is dropped)
Sourcepub fn start_worker_with_access_control<W>(
&self,
address: impl Into<Address>,
worker: W,
incoming: impl IncomingAccessControl,
outgoing: impl OutgoingAccessControl,
) -> Result<(), Error>
pub fn start_worker_with_access_control<W>( &self, address: impl Into<Address>, worker: W, incoming: impl IncomingAccessControl, outgoing: impl OutgoingAccessControl, ) -> Result<(), Error>
Start a new worker instance at the given address
A worker is an asynchronous piece of code that can send and
receive messages of a specific type. This type is encoded via
the Worker
trait. If your code relies
on a manual run-loop you may want to use
start_processor()
instead!
Each address in the set must be unique and unused on the current node. Workers must implement the Worker trait and be thread-safe. Workers run asynchronously and will be scheduled independently of each other.
use ockam_core::{AllowAll, Result, Worker, worker};
use ockam_node::Context;
struct MyWorker;
#[worker]
impl Worker for MyWorker {
type Context = Context;
type Message = String;
}
fn start_my_worker(ctx: &mut Context) -> Result<()> {
ctx.start_worker_with_access_control("my-worker-address", MyWorker, AllowAll, AllowAll)
}
Sourcepub fn start_processor<P>(
&self,
address: impl Into<Address>,
processor: P,
) -> Result<(), Error>
pub fn start_processor<P>( &self, address: impl Into<Address>, processor: P, ) -> Result<(), Error>
Start a new processor instance at the given address. Default AccessControl is DenyAll
A processor is an asynchronous piece of code that runs a
custom run loop, with access to a worker context to send and
receive messages. If your code is built around responding to
message events, consider using
start_worker()
instead!
Approximate flow of starting a processor:
- StartProcessor message -> Router
- First address is considered a primary_addr (main_addr)
- Check if router.map.address_records_map already has primary_addr
- AddressRecord is created and inserted in router.map
- Iterate over metadata: Check if it belongs to that record Set is_terminal true in router.map.address_metadata_map (if address is terminal) Insert attributes one by one
- For each address we insert pair (Address, primary_addr) into router.map.alias_map, including (primary_addr, primary_addr itself)
- ProcessorRelay is spawned as a tokio task: ProcessorRelay calls Processor::initialize ProcessorRelay calls Processor::process until either false is returned or stop signal is received (CtrlSignal::InterruptStop to AddressRecord::ctrl_tx)
Sourcepub fn start_processor_with_access_control<P>(
&self,
address: impl Into<Address>,
processor: P,
incoming: impl IncomingAccessControl,
outgoing: impl OutgoingAccessControl,
) -> Result<(), Error>
pub fn start_processor_with_access_control<P>( &self, address: impl Into<Address>, processor: P, incoming: impl IncomingAccessControl, outgoing: impl OutgoingAccessControl, ) -> Result<(), Error>
Start a new processor instance at the given address
A processor is an asynchronous piece of code that runs a
custom run loop, with access to a worker context to send and
receive messages. If your code is built around responding to
message events, consider using
start_worker()
instead!
Sourcepub fn stop_address(&self, address: &Address) -> Result<(), Error>
pub fn stop_address(&self, address: &Address) -> Result<(), Error>
Stop a Worker or a Processor running on given Address
Sourcepub fn stop_primary_address(&self) -> Result<(), Error>
pub fn stop_primary_address(&self) -> Result<(), Error>
Stop a Worker or a Processor running on the context primary address
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Context
impl !RefUnwindSafe for Context
impl Send for Context
impl Sync for Context
impl Unpin for Context
impl !UnwindSafe for Context
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> 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<D> OwoColorize for D
impl<D> OwoColorize for D
Source§fn fg<C>(&self) -> FgColorDisplay<'_, C, Self>where
C: Color,
fn fg<C>(&self) -> FgColorDisplay<'_, C, Self>where
C: Color,
Source§fn bg<C>(&self) -> BgColorDisplay<'_, C, Self>where
C: Color,
fn bg<C>(&self) -> BgColorDisplay<'_, C, Self>where
C: Color,
Source§fn black(&self) -> FgColorDisplay<'_, Black, Self>
fn black(&self) -> FgColorDisplay<'_, Black, Self>
Source§fn on_black(&self) -> BgColorDisplay<'_, Black, Self>
fn on_black(&self) -> BgColorDisplay<'_, Black, Self>
Source§fn red(&self) -> FgColorDisplay<'_, Red, Self>
fn red(&self) -> FgColorDisplay<'_, Red, Self>
Source§fn on_red(&self) -> BgColorDisplay<'_, Red, Self>
fn on_red(&self) -> BgColorDisplay<'_, Red, Self>
Source§fn green(&self) -> FgColorDisplay<'_, Green, Self>
fn green(&self) -> FgColorDisplay<'_, Green, Self>
Source§fn on_green(&self) -> BgColorDisplay<'_, Green, Self>
fn on_green(&self) -> BgColorDisplay<'_, Green, Self>
Source§fn yellow(&self) -> FgColorDisplay<'_, Yellow, Self>
fn yellow(&self) -> FgColorDisplay<'_, Yellow, Self>
Source§fn on_yellow(&self) -> BgColorDisplay<'_, Yellow, Self>
fn on_yellow(&self) -> BgColorDisplay<'_, Yellow, Self>
Source§fn blue(&self) -> FgColorDisplay<'_, Blue, Self>
fn blue(&self) -> FgColorDisplay<'_, Blue, Self>
Source§fn on_blue(&self) -> BgColorDisplay<'_, Blue, Self>
fn on_blue(&self) -> BgColorDisplay<'_, Blue, Self>
Source§fn magenta(&self) -> FgColorDisplay<'_, Magenta, Self>
fn magenta(&self) -> FgColorDisplay<'_, Magenta, Self>
Source§fn on_magenta(&self) -> BgColorDisplay<'_, Magenta, Self>
fn on_magenta(&self) -> BgColorDisplay<'_, Magenta, Self>
Source§fn purple(&self) -> FgColorDisplay<'_, Magenta, Self>
fn purple(&self) -> FgColorDisplay<'_, Magenta, Self>
Source§fn on_purple(&self) -> BgColorDisplay<'_, Magenta, Self>
fn on_purple(&self) -> BgColorDisplay<'_, Magenta, Self>
Source§fn cyan(&self) -> FgColorDisplay<'_, Cyan, Self>
fn cyan(&self) -> FgColorDisplay<'_, Cyan, Self>
Source§fn on_cyan(&self) -> BgColorDisplay<'_, Cyan, Self>
fn on_cyan(&self) -> BgColorDisplay<'_, Cyan, Self>
Source§fn white(&self) -> FgColorDisplay<'_, White, Self>
fn white(&self) -> FgColorDisplay<'_, White, Self>
Source§fn on_white(&self) -> BgColorDisplay<'_, White, Self>
fn on_white(&self) -> BgColorDisplay<'_, White, Self>
Source§fn default_color(&self) -> FgColorDisplay<'_, Default, Self>
fn default_color(&self) -> FgColorDisplay<'_, Default, Self>
Source§fn on_default_color(&self) -> BgColorDisplay<'_, Default, Self>
fn on_default_color(&self) -> BgColorDisplay<'_, Default, Self>
Source§fn bright_black(&self) -> FgColorDisplay<'_, BrightBlack, Self>
fn bright_black(&self) -> FgColorDisplay<'_, BrightBlack, Self>
Source§fn on_bright_black(&self) -> BgColorDisplay<'_, BrightBlack, Self>
fn on_bright_black(&self) -> BgColorDisplay<'_, BrightBlack, Self>
Source§fn bright_red(&self) -> FgColorDisplay<'_, BrightRed, Self>
fn bright_red(&self) -> FgColorDisplay<'_, BrightRed, Self>
Source§fn on_bright_red(&self) -> BgColorDisplay<'_, BrightRed, Self>
fn on_bright_red(&self) -> BgColorDisplay<'_, BrightRed, Self>
Source§fn bright_green(&self) -> FgColorDisplay<'_, BrightGreen, Self>
fn bright_green(&self) -> FgColorDisplay<'_, BrightGreen, Self>
Source§fn on_bright_green(&self) -> BgColorDisplay<'_, BrightGreen, Self>
fn on_bright_green(&self) -> BgColorDisplay<'_, BrightGreen, Self>
Source§fn bright_yellow(&self) -> FgColorDisplay<'_, BrightYellow, Self>
fn bright_yellow(&self) -> FgColorDisplay<'_, BrightYellow, Self>
Source§fn on_bright_yellow(&self) -> BgColorDisplay<'_, BrightYellow, Self>
fn on_bright_yellow(&self) -> BgColorDisplay<'_, BrightYellow, Self>
Source§fn bright_blue(&self) -> FgColorDisplay<'_, BrightBlue, Self>
fn bright_blue(&self) -> FgColorDisplay<'_, BrightBlue, Self>
Source§fn on_bright_blue(&self) -> BgColorDisplay<'_, BrightBlue, Self>
fn on_bright_blue(&self) -> BgColorDisplay<'_, BrightBlue, Self>
Source§fn bright_magenta(&self) -> FgColorDisplay<'_, BrightMagenta, Self>
fn bright_magenta(&self) -> FgColorDisplay<'_, BrightMagenta, Self>
Source§fn on_bright_magenta(&self) -> BgColorDisplay<'_, BrightMagenta, Self>
fn on_bright_magenta(&self) -> BgColorDisplay<'_, BrightMagenta, Self>
Source§fn bright_purple(&self) -> FgColorDisplay<'_, BrightMagenta, Self>
fn bright_purple(&self) -> FgColorDisplay<'_, BrightMagenta, Self>
Source§fn on_bright_purple(&self) -> BgColorDisplay<'_, BrightMagenta, Self>
fn on_bright_purple(&self) -> BgColorDisplay<'_, BrightMagenta, Self>
Source§fn bright_cyan(&self) -> FgColorDisplay<'_, BrightCyan, Self>
fn bright_cyan(&self) -> FgColorDisplay<'_, BrightCyan, Self>
Source§fn on_bright_cyan(&self) -> BgColorDisplay<'_, BrightCyan, Self>
fn on_bright_cyan(&self) -> BgColorDisplay<'_, BrightCyan, Self>
Source§fn bright_white(&self) -> FgColorDisplay<'_, BrightWhite, Self>
fn bright_white(&self) -> FgColorDisplay<'_, BrightWhite, Self>
Source§fn on_bright_white(&self) -> BgColorDisplay<'_, BrightWhite, Self>
fn on_bright_white(&self) -> BgColorDisplay<'_, BrightWhite, Self>
Source§fn bold(&self) -> BoldDisplay<'_, Self>
fn bold(&self) -> BoldDisplay<'_, Self>
Source§fn dimmed(&self) -> DimDisplay<'_, Self>
fn dimmed(&self) -> DimDisplay<'_, Self>
Source§fn italic(&self) -> ItalicDisplay<'_, Self>
fn italic(&self) -> ItalicDisplay<'_, Self>
Source§fn underline(&self) -> UnderlineDisplay<'_, Self>
fn underline(&self) -> UnderlineDisplay<'_, Self>
Source§fn blink(&self) -> BlinkDisplay<'_, Self>
fn blink(&self) -> BlinkDisplay<'_, Self>
Source§fn blink_fast(&self) -> BlinkFastDisplay<'_, Self>
fn blink_fast(&self) -> BlinkFastDisplay<'_, Self>
Source§fn reversed(&self) -> ReversedDisplay<'_, Self>
fn reversed(&self) -> ReversedDisplay<'_, Self>
Source§fn strikethrough(&self) -> StrikeThroughDisplay<'_, Self>
fn strikethrough(&self) -> StrikeThroughDisplay<'_, Self>
Source§fn color<Color>(&self, color: Color) -> FgDynColorDisplay<'_, Color, Self>where
Color: DynColor,
fn color<Color>(&self, color: Color) -> FgDynColorDisplay<'_, Color, Self>where
Color: DynColor,
OwoColorize::fg
or
a color-specific method, such as OwoColorize::green
, Read moreSource§fn on_color<Color>(&self, color: Color) -> BgDynColorDisplay<'_, Color, Self>where
Color: DynColor,
fn on_color<Color>(&self, color: Color) -> BgDynColorDisplay<'_, Color, Self>where
Color: DynColor,
OwoColorize::bg
or
a color-specific method, such as OwoColorize::on_yellow
, Read more