pub struct PeerSet<D, C>where
D: Discover<Key = PeerSocketAddr, Service = LoadTrackedClient> + Unpin,
D::Error: Into<BoxError>,
C: ChainTip,{Show 13 fields
discover: D,
demand_signal: Sender<MorePeers>,
ready_services: HashMap<D::Key, D::Service>,
inventory_registry: InventoryRegistry,
unready_services: FuturesUnordered<UnreadyService<D::Key, D::Service, Request>>,
cancel_handles: HashMap<D::Key, Sender<CancelClientWork>>,
minimum_peer_version: MinimumPeerVersion<C>,
peerset_total_connection_limit: usize,
handle_rx: Receiver<Vec<JoinHandle<Result<(), BoxError>>>>,
guards: FuturesUnordered<JoinHandle<Result<(), BoxError>>>,
address_metrics: Receiver<AddressMetrics>,
last_peer_log: Option<Instant>,
max_conns_per_ip: usize,
}
Expand description
A [tower::Service
] that abstractly represents “the rest of the network”.
§Security
The Discover::Key
must be the transient remote address of each peer. This
address may only be valid for the duration of a single connection. (For
example, inbound connections have an ephemeral remote port, and proxy
connections have an ephemeral local or proxy port.)
Otherwise, malicious peers could interfere with other peers’ PeerSet
state.
Fields§
§discover: D
Provides new and deleted peer [Change
]s to the peer set,
via the [Discover
] trait implementation.
demand_signal: Sender<MorePeers>
A channel that asks the peer crawler task to connect to more peers.
ready_services: HashMap<D::Key, D::Service>
Connected peers that are ready to receive requests from Zebra, or send requests to Zebra.
inventory_registry: InventoryRegistry
Stores gossiped inventory hashes from connected peers.
Used to route inventory requests to peers that are likely to have it.
unready_services: FuturesUnordered<UnreadyService<D::Key, D::Service, Request>>
Connected peers that are handling a Zebra request, or Zebra is handling one of their requests.
cancel_handles: HashMap<D::Key, Sender<CancelClientWork>>
Channels used to cancel the request that an unready service is doing.
minimum_peer_version: MinimumPeerVersion<C>
An endpoint to see the minimum peer protocol version in real time.
The minimum version depends on the block height, and MinimumPeerVersion
listens for
height changes and determines the correct minimum version.
peerset_total_connection_limit: usize
The configured limit for inbound and outbound connections.
The peer set panics if this size is exceeded. If that happens, our connection limit code has a bug.
handle_rx: Receiver<Vec<JoinHandle<Result<(), BoxError>>>>
Channel for passing ownership of tokio JoinHandles from PeerSet’s background tasks
The join handles passed into the PeerSet are used populate the guards
member
guards: FuturesUnordered<JoinHandle<Result<(), BoxError>>>
Unordered set of handles to background tasks associated with the PeerSet
These guards are checked for errors as part of poll_ready
which lets
the PeerSet
propagate errors from background tasks back to the user
address_metrics: Receiver<AddressMetrics>
Address book metrics watch channel.
Used for logging diagnostics.
last_peer_log: Option<Instant>
The last time we logged a message about the peer set size
max_conns_per_ip: usize
The configured maximum number of peers that can be in the
peer set per IP, defaults to crate::constants::DEFAULT_MAX_CONNS_PER_IP
Implementations§
source§impl<D, C> PeerSet<D, C>where
D: Discover<Key = PeerSocketAddr, Service = LoadTrackedClient> + Unpin,
D::Error: Into<BoxError>,
C: ChainTip,
impl<D, C> PeerSet<D, C>where
D: Discover<Key = PeerSocketAddr, Service = LoadTrackedClient> + Unpin,
D::Error: Into<BoxError>,
C: ChainTip,
sourcepub fn new(
config: &Config,
discover: D,
demand_signal: Sender<MorePeers>,
handle_rx: Receiver<Vec<JoinHandle<Result<(), BoxError>>>>,
inv_stream: Receiver<InventoryResponse<(AtLeastOne<InventoryHash>, PeerSocketAddr), (AtLeastOne<InventoryHash>, PeerSocketAddr)>>,
address_metrics: Receiver<AddressMetrics>,
minimum_peer_version: MinimumPeerVersion<C>,
max_conns_per_ip: Option<usize>,
) -> Self
pub fn new( config: &Config, discover: D, demand_signal: Sender<MorePeers>, handle_rx: Receiver<Vec<JoinHandle<Result<(), BoxError>>>>, inv_stream: Receiver<InventoryResponse<(AtLeastOne<InventoryHash>, PeerSocketAddr), (AtLeastOne<InventoryHash>, PeerSocketAddr)>>, address_metrics: Receiver<AddressMetrics>, minimum_peer_version: MinimumPeerVersion<C>, max_conns_per_ip: Option<usize>, ) -> Self
Construct a peerset which uses discover
to manage peer connections.
Arguments:
config
: configures the peer set connection limit;discover
: handles peer connects and disconnects;demand_signal
: requests more peers when all peers are busy (unready);handle_rx
: receives background task handles, monitors them to make sure they’re still running, and shuts down all the tasks as soon as one task exits;inv_stream
: receives inventory changes from peers, allowing the peer set to direct inventory requests;address_book
: when peer set is busy, it logs address book diagnostics.minimum_peer_version
: endpoint to see the minimum peer protocol version in real time.max_conns_per_ip
: configured maximum number of peers that can be in the peer set per IP, defaults to the config value or tocrate::constants::DEFAULT_MAX_CONNS_PER_IP
.
sourcefn poll_background_errors(
&mut self,
cx: &mut Context<'_>,
) -> Poll<Result<(), BoxError>>
fn poll_background_errors( &mut self, cx: &mut Context<'_>, ) -> Poll<Result<(), BoxError>>
Check background task handles to make sure they’re still running.
Never returns Ok
.
If any background task exits, shuts down all other background tasks,
and returns an error. Otherwise, returns Pending
, and registers a wakeup for
receiving the background tasks, or the background tasks exiting.
sourcefn receive_tasks_if_needed(
&mut self,
cx: &mut Context<'_>,
) -> Poll<Result<(), BoxError>>
fn receive_tasks_if_needed( &mut self, cx: &mut Context<'_>, ) -> Poll<Result<(), BoxError>>
Receive background tasks, if they’ve been sent on the channel, but not consumed yet.
Returns a result representing the current task state, or Poll::Pending
if the background
tasks should be polled again to check their state.
sourcefn shut_down_tasks_and_channels(&mut self, cx: &mut Context<'_>)
fn shut_down_tasks_and_channels(&mut self, cx: &mut Context<'_>)
Shut down:
- services by dropping the service lists
- background tasks via their join handles or cancel handles
- channels by closing the channel
sourcefn poll_unready(
&mut self,
cx: &mut Context<'_>,
) -> Poll<Result<Option<()>, BoxError>>
fn poll_unready( &mut self, cx: &mut Context<'_>, ) -> Poll<Result<Option<()>, BoxError>>
Check busy peer services for request completion or errors.
Move newly ready services to the ready list if they are for peers with supported protocol versions, otherwise they are dropped. Also drop failed services.
Never returns an error.
Returns Ok(Some(())
if at least one peer became ready, Poll::Pending
if there are
unready peers, but none became ready, and Ok(None)
if the unready peers were empty.
If there are any remaining unready peers, registers a wakeup for the next time one becomes ready. If there are no unready peers, doesn’t register any wakeups. (Since wakeups come from peers, there needs to be at least one peer to register a wakeup.)
sourcefn poll_ready_peer_errors(&mut self, cx: &mut Context<'_>) -> Poll<()>
fn poll_ready_peer_errors(&mut self, cx: &mut Context<'_>) -> Poll<()>
Checks previously ready peer services for errors.
The only way these peer Client
s can become unready is when we send them a request,
because the peer set has exclusive access to send requests to each peer. (If an inbound
request is in progress, it will be handled, then our request will be sent by the connection
task.)
Returns Poll::Ready
if there are some ready peers, and Poll::Pending
if there are no
ready peers. Registers a wakeup if any peer has failed due to a disconnection, hang, or protocol error.
§Panics
If any peers somehow became unready without being sent a request. This indicates a bug in the peer set, where requests
are sent to peers without putting them in unready_peers
.
sourcefn num_peers_with_ip(&self, ip: IpAddr) -> usize
fn num_peers_with_ip(&self, ip: IpAddr) -> usize
Returns the number of peer connections Zebra already has with the provided IP address
§Performance
This method is O(connected peers)
, so it should not be called from a loop
that is already iterating through the peer set.
sourcefn has_peer_with_addr(&self, addr: PeerSocketAddr) -> bool
fn has_peer_with_addr(&self, addr: PeerSocketAddr) -> bool
Returns true
if Zebra is already connected to the IP and port in addr
.
sourcefn poll_discover(&mut self, cx: &mut Context<'_>) -> Poll<Result<(), BoxError>>
fn poll_discover(&mut self, cx: &mut Context<'_>) -> Poll<Result<(), BoxError>>
Processes the entire list of newly inserted or removed services.
Puts inserted services in the unready list. Drops removed services, after cancelling any pending requests.
If the peer connector channel is closed, returns an error.
Otherwise, returns Ok
if it discovered at least one peer, or Poll::Pending
if it didn’t
discover any peers. Always registers a wakeup for new peers, even when it returns Ok
.
sourcefn disconnect_from_outdated_peers(&mut self)
fn disconnect_from_outdated_peers(&mut self)
Checks if the minimum peer version has changed, and disconnects from outdated peers.
sourcefn take_ready_service(&mut self, key: &D::Key) -> Option<D::Service>
fn take_ready_service(&mut self, key: &D::Key) -> Option<D::Service>
Takes a ready service by key.
sourcefn remove(&mut self, key: &D::Key)
fn remove(&mut self, key: &D::Key)
Remove the service corresponding to key
from the peer set.
Drops the service, cancelling any pending request or response to that peer. If the peer does not exist, does nothing.
sourcefn push_ready(&mut self, was_unready: bool, key: D::Key, svc: D::Service)
fn push_ready(&mut self, was_unready: bool, key: D::Key, svc: D::Service)
Adds a ready service to the ready list if it’s for a peer with a supported version.
If was_unready
is true, also removes the peer’s cancel handle.
If the service is for a connection to an outdated peer, the service is dropped.
sourcefn push_unready(&mut self, key: D::Key, svc: D::Service)
fn push_unready(&mut self, key: D::Key, svc: D::Service)
Adds a busy service to the unready list if it’s for a peer with a supported version, and adds a cancel handle for the service’s current request.
If the service is for a connection to an outdated peer, the request is cancelled and the service is dropped.
sourcefn select_ready_p2c_peer(&self) -> Option<D::Key>
fn select_ready_p2c_peer(&self) -> Option<D::Key>
Performs P2C on self.ready_services
to randomly select a less-loaded ready service.
sourcefn select_p2c_peer_from_list(
&self,
ready_service_list: &HashSet<D::Key>,
) -> Option<D::Key>
fn select_p2c_peer_from_list( &self, ready_service_list: &HashSet<D::Key>, ) -> Option<D::Key>
Performs P2C on ready_service_list
to randomly select a less-loaded ready service.
sourcefn select_random_ready_peers(&self, max_peers: usize) -> Vec<D::Key>
fn select_random_ready_peers(&self, max_peers: usize) -> Vec<D::Key>
Randomly chooses max_peers
ready services, ignoring service load.
The chosen peers are unique, but their order is not fully random.
sourcefn query_load(&self, key: &D::Key) -> Option<<D::Service as Load>::Metric>
fn query_load(&self, key: &D::Key) -> Option<<D::Service as Load>::Metric>
Accesses a ready endpoint by key
and returns its current load.
Returns None
if the service is not in the ready service list.
sourcefn route_p2c(&mut self, req: Request) -> <Self as Service<Request>>::Future
fn route_p2c(&mut self, req: Request) -> <Self as Service<Request>>::Future
Routes a request using P2C load-balancing.
sourcefn route_inv(
&mut self,
req: Request,
hash: InventoryHash,
) -> <Self as Service<Request>>::Future
fn route_inv( &mut self, req: Request, hash: InventoryHash, ) -> <Self as Service<Request>>::Future
Tries to route a request to a ready peer that advertised that inventory, falling back to a ready peer that isn’t missing the inventory.
If all ready peers are missing the inventory,
returns a synthetic NotFoundRegistry
error.
Uses P2C to route requests to the least loaded peer in each list.
sourcefn route_multiple(
&mut self,
req: Request,
max_peers: usize,
) -> <Self as Service<Request>>::Future
fn route_multiple( &mut self, req: Request, max_peers: usize, ) -> <Self as Service<Request>>::Future
Routes the same request to up to max_peers
ready peers, ignoring return values.
max_peers
must be at least one, and at most the number of ready peers.
sourcefn route_broadcast(
&mut self,
req: Request,
) -> <Self as Service<Request>>::Future
fn route_broadcast( &mut self, req: Request, ) -> <Self as Service<Request>>::Future
Broadcasts the same request to lots of ready peers, ignoring return values.
sourcepub(crate) fn number_of_peers_to_broadcast(&self) -> usize
pub(crate) fn number_of_peers_to_broadcast(&self) -> usize
Given a number of ready peers calculate to how many of them Zebra will actually send the request to. Return this number.
sourcefn peer_set_addresses(&self) -> Vec<PeerSocketAddr>
fn peer_set_addresses(&self) -> Vec<PeerSocketAddr>
Returns the list of addresses in the peer set.
sourcefn log_peer_set_size(&mut self)
fn log_peer_set_size(&mut self)
Logs the peer set size, and any potential connectivity issues.
sourcefn update_metrics(&self)
fn update_metrics(&self)
Trait Implementations§
source§impl<D, C> Drop for PeerSet<D, C>where
D: Discover<Key = PeerSocketAddr, Service = LoadTrackedClient> + Unpin,
D::Error: Into<BoxError>,
C: ChainTip,
impl<D, C> Drop for PeerSet<D, C>where
D: Discover<Key = PeerSocketAddr, Service = LoadTrackedClient> + Unpin,
D::Error: Into<BoxError>,
C: ChainTip,
source§impl<D, C> Service<Request> for PeerSet<D, C>where
D: Discover<Key = PeerSocketAddr, Service = LoadTrackedClient> + Unpin,
D::Error: Into<BoxError>,
C: ChainTip,
impl<D, C> Service<Request> for PeerSet<D, C>where
D: Discover<Key = PeerSocketAddr, Service = LoadTrackedClient> + Unpin,
D::Error: Into<BoxError>,
C: ChainTip,
source§type Future = Pin<Box<dyn Future<Output = Result<<PeerSet<D, C> as Service<Request>>::Response, <PeerSet<D, C> as Service<Request>>::Error>> + Send>>
type Future = Pin<Box<dyn Future<Output = Result<<PeerSet<D, C> as Service<Request>>::Response, <PeerSet<D, C> as Service<Request>>::Error>> + Send>>
Auto Trait Implementations§
impl<D, C> !Freeze for PeerSet<D, C>
impl<D, C> !RefUnwindSafe for PeerSet<D, C>
impl<D, C> Send for PeerSet<D, C>
impl<D, C> !Sync for PeerSet<D, C>
impl<D, C> Unpin for PeerSet<D, C>
impl<D, C> !UnwindSafe for PeerSet<D, C>
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
§impl<T> Conv for T
impl<T> Conv for T
§impl<T> FmtForward for T
impl<T> FmtForward for T
§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.§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.§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.§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.§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.§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.§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.§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.§fn fmt_list(self) -> FmtList<Self>where
&'a Self: for<'a> IntoIterator,
fn fmt_list(self) -> FmtList<Self>where
&'a Self: for<'a> IntoIterator,
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<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<S, Request> IsReady<Request> for Swhere
S: Service<Request> + Send,
Request: 'static,
impl<S, Request> IsReady<Request> for Swhere
S: Service<Request> + Send,
Request: 'static,
source§fn is_ready(&mut self) -> Pin<Box<dyn Future<Output = bool> + Send + '_>>
fn is_ready(&mut self) -> Pin<Box<dyn Future<Output = bool> + Send + '_>>
Service
] once, and return true if it is immediately ready to be called.§impl<D> OwoColorize for D
impl<D> OwoColorize for D
§fn fg<C>(&self) -> FgColorDisplay<'_, C, Self>where
C: Color,
fn fg<C>(&self) -> FgColorDisplay<'_, C, Self>where
C: Color,
§fn bg<C>(&self) -> BgColorDisplay<'_, C, Self>where
C: Color,
fn bg<C>(&self) -> BgColorDisplay<'_, C, Self>where
C: Color,
§fn on_yellow<'a>(&'a self) -> BgColorDisplay<'a, Yellow, Self>
fn on_yellow<'a>(&'a self) -> BgColorDisplay<'a, Yellow, Self>
§fn magenta<'a>(&'a self) -> FgColorDisplay<'a, Magenta, Self>
fn magenta<'a>(&'a self) -> FgColorDisplay<'a, Magenta, Self>
§fn on_magenta<'a>(&'a self) -> BgColorDisplay<'a, Magenta, Self>
fn on_magenta<'a>(&'a self) -> BgColorDisplay<'a, Magenta, Self>
§fn on_purple<'a>(&'a self) -> BgColorDisplay<'a, Magenta, Self>
fn on_purple<'a>(&'a self) -> BgColorDisplay<'a, Magenta, Self>
§fn default_color<'a>(&'a self) -> FgColorDisplay<'a, Default, Self>
fn default_color<'a>(&'a self) -> FgColorDisplay<'a, Default, Self>
§fn on_default_color<'a>(&'a self) -> BgColorDisplay<'a, Default, Self>
fn on_default_color<'a>(&'a self) -> BgColorDisplay<'a, Default, Self>
§fn bright_black<'a>(&'a self) -> FgColorDisplay<'a, BrightBlack, Self>
fn bright_black<'a>(&'a self) -> FgColorDisplay<'a, BrightBlack, Self>
§fn on_bright_black<'a>(&'a self) -> BgColorDisplay<'a, BrightBlack, Self>
fn on_bright_black<'a>(&'a self) -> BgColorDisplay<'a, BrightBlack, Self>
§fn bright_red<'a>(&'a self) -> FgColorDisplay<'a, BrightRed, Self>
fn bright_red<'a>(&'a self) -> FgColorDisplay<'a, BrightRed, Self>
§fn on_bright_red<'a>(&'a self) -> BgColorDisplay<'a, BrightRed, Self>
fn on_bright_red<'a>(&'a self) -> BgColorDisplay<'a, BrightRed, Self>
§fn bright_green<'a>(&'a self) -> FgColorDisplay<'a, BrightGreen, Self>
fn bright_green<'a>(&'a self) -> FgColorDisplay<'a, BrightGreen, Self>
§fn on_bright_green<'a>(&'a self) -> BgColorDisplay<'a, BrightGreen, Self>
fn on_bright_green<'a>(&'a self) -> BgColorDisplay<'a, BrightGreen, Self>
§fn bright_yellow<'a>(&'a self) -> FgColorDisplay<'a, BrightYellow, Self>
fn bright_yellow<'a>(&'a self) -> FgColorDisplay<'a, BrightYellow, Self>
§fn on_bright_yellow<'a>(&'a self) -> BgColorDisplay<'a, BrightYellow, Self>
fn on_bright_yellow<'a>(&'a self) -> BgColorDisplay<'a, BrightYellow, Self>
§fn bright_blue<'a>(&'a self) -> FgColorDisplay<'a, BrightBlue, Self>
fn bright_blue<'a>(&'a self) -> FgColorDisplay<'a, BrightBlue, Self>
§fn on_bright_blue<'a>(&'a self) -> BgColorDisplay<'a, BrightBlue, Self>
fn on_bright_blue<'a>(&'a self) -> BgColorDisplay<'a, BrightBlue, Self>
§fn bright_magenta<'a>(&'a self) -> FgColorDisplay<'a, BrightMagenta, Self>
fn bright_magenta<'a>(&'a self) -> FgColorDisplay<'a, BrightMagenta, Self>
§fn on_bright_magenta<'a>(&'a self) -> BgColorDisplay<'a, BrightMagenta, Self>
fn on_bright_magenta<'a>(&'a self) -> BgColorDisplay<'a, BrightMagenta, Self>
§fn bright_purple<'a>(&'a self) -> FgColorDisplay<'a, BrightMagenta, Self>
fn bright_purple<'a>(&'a self) -> FgColorDisplay<'a, BrightMagenta, Self>
§fn on_bright_purple<'a>(&'a self) -> BgColorDisplay<'a, BrightMagenta, Self>
fn on_bright_purple<'a>(&'a self) -> BgColorDisplay<'a, BrightMagenta, Self>
§fn bright_cyan<'a>(&'a self) -> FgColorDisplay<'a, BrightCyan, Self>
fn bright_cyan<'a>(&'a self) -> FgColorDisplay<'a, BrightCyan, Self>
§fn on_bright_cyan<'a>(&'a self) -> BgColorDisplay<'a, BrightCyan, Self>
fn on_bright_cyan<'a>(&'a self) -> BgColorDisplay<'a, BrightCyan, Self>
§fn bright_white<'a>(&'a self) -> FgColorDisplay<'a, BrightWhite, Self>
fn bright_white<'a>(&'a self) -> FgColorDisplay<'a, BrightWhite, Self>
§fn on_bright_white<'a>(&'a self) -> BgColorDisplay<'a, BrightWhite, Self>
fn on_bright_white<'a>(&'a self) -> BgColorDisplay<'a, BrightWhite, Self>
§fn blink_fast<'a>(&'a self) -> BlinkFastDisplay<'a, Self>
fn blink_fast<'a>(&'a self) -> BlinkFastDisplay<'a, Self>
§fn strikethrough<'a>(&'a self) -> StrikeThroughDisplay<'a, Self>
fn strikethrough<'a>(&'a self) -> StrikeThroughDisplay<'a, Self>
§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 more§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§fn fg_rgb<const R: u8, const G: u8, const B: u8>(
&self,
) -> FgColorDisplay<'_, CustomColor<R, G, B>, Self>
fn fg_rgb<const R: u8, const G: u8, const B: u8>( &self, ) -> FgColorDisplay<'_, CustomColor<R, G, B>, Self>
§fn bg_rgb<const R: u8, const G: u8, const B: u8>(
&self,
) -> BgColorDisplay<'_, CustomColor<R, G, B>, Self>
fn bg_rgb<const R: u8, const G: u8, const B: u8>( &self, ) -> BgColorDisplay<'_, CustomColor<R, G, B>, Self>
§fn truecolor(&self, r: u8, g: u8, b: u8) -> FgDynColorDisplay<'_, Rgb, Self>
fn truecolor(&self, r: u8, g: u8, b: u8) -> FgDynColorDisplay<'_, Rgb, Self>
§fn on_truecolor(&self, r: u8, g: u8, b: u8) -> BgDynColorDisplay<'_, Rgb, Self>
fn on_truecolor(&self, r: u8, g: u8, b: u8) -> BgDynColorDisplay<'_, Rgb, Self>
§impl<D> OwoColorize for D
impl<D> OwoColorize for D
§fn fg<C>(&self) -> FgColorDisplay<'_, C, Self>where
C: Color,
fn fg<C>(&self) -> FgColorDisplay<'_, C, Self>where
C: Color,
§fn bg<C>(&self) -> BgColorDisplay<'_, C, Self>where
C: Color,
fn bg<C>(&self) -> BgColorDisplay<'_, C, Self>where
C: Color,
§fn on_magenta(&self) -> BgColorDisplay<'_, Magenta, Self>
fn on_magenta(&self) -> BgColorDisplay<'_, Magenta, Self>
§fn default_color(&self) -> FgColorDisplay<'_, Default, Self>
fn default_color(&self) -> FgColorDisplay<'_, Default, Self>
§fn on_default_color(&self) -> BgColorDisplay<'_, Default, Self>
fn on_default_color(&self) -> BgColorDisplay<'_, Default, Self>
§fn bright_black(&self) -> FgColorDisplay<'_, BrightBlack, Self>
fn bright_black(&self) -> FgColorDisplay<'_, BrightBlack, Self>
§fn on_bright_black(&self) -> BgColorDisplay<'_, BrightBlack, Self>
fn on_bright_black(&self) -> BgColorDisplay<'_, BrightBlack, Self>
§fn bright_red(&self) -> FgColorDisplay<'_, BrightRed, Self>
fn bright_red(&self) -> FgColorDisplay<'_, BrightRed, Self>
§fn on_bright_red(&self) -> BgColorDisplay<'_, BrightRed, Self>
fn on_bright_red(&self) -> BgColorDisplay<'_, BrightRed, Self>
§fn bright_green(&self) -> FgColorDisplay<'_, BrightGreen, Self>
fn bright_green(&self) -> FgColorDisplay<'_, BrightGreen, Self>
§fn on_bright_green(&self) -> BgColorDisplay<'_, BrightGreen, Self>
fn on_bright_green(&self) -> BgColorDisplay<'_, BrightGreen, Self>
§fn bright_yellow(&self) -> FgColorDisplay<'_, BrightYellow, Self>
fn bright_yellow(&self) -> FgColorDisplay<'_, BrightYellow, Self>
§fn on_bright_yellow(&self) -> BgColorDisplay<'_, BrightYellow, Self>
fn on_bright_yellow(&self) -> BgColorDisplay<'_, BrightYellow, Self>
§fn bright_blue(&self) -> FgColorDisplay<'_, BrightBlue, Self>
fn bright_blue(&self) -> FgColorDisplay<'_, BrightBlue, Self>
§fn on_bright_blue(&self) -> BgColorDisplay<'_, BrightBlue, Self>
fn on_bright_blue(&self) -> BgColorDisplay<'_, BrightBlue, Self>
§fn bright_magenta(&self) -> FgColorDisplay<'_, BrightMagenta, Self>
fn bright_magenta(&self) -> FgColorDisplay<'_, BrightMagenta, Self>
§fn on_bright_magenta(&self) -> BgColorDisplay<'_, BrightMagenta, Self>
fn on_bright_magenta(&self) -> BgColorDisplay<'_, BrightMagenta, Self>
§fn bright_purple(&self) -> FgColorDisplay<'_, BrightMagenta, Self>
fn bright_purple(&self) -> FgColorDisplay<'_, BrightMagenta, Self>
§fn on_bright_purple(&self) -> BgColorDisplay<'_, BrightMagenta, Self>
fn on_bright_purple(&self) -> BgColorDisplay<'_, BrightMagenta, Self>
§fn bright_cyan(&self) -> FgColorDisplay<'_, BrightCyan, Self>
fn bright_cyan(&self) -> FgColorDisplay<'_, BrightCyan, Self>
§fn on_bright_cyan(&self) -> BgColorDisplay<'_, BrightCyan, Self>
fn on_bright_cyan(&self) -> BgColorDisplay<'_, BrightCyan, Self>
§fn bright_white(&self) -> FgColorDisplay<'_, BrightWhite, Self>
fn bright_white(&self) -> FgColorDisplay<'_, BrightWhite, Self>
§fn on_bright_white(&self) -> BgColorDisplay<'_, BrightWhite, Self>
fn on_bright_white(&self) -> BgColorDisplay<'_, BrightWhite, Self>
§fn blink_fast(&self) -> BlinkFastDisplay<'_, Self>
fn blink_fast(&self) -> BlinkFastDisplay<'_, Self>
§fn strikethrough(&self) -> StrikeThroughDisplay<'_, Self>
fn strikethrough(&self) -> StrikeThroughDisplay<'_, Self>
§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 more§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§fn fg_rgb<const R: u8, const G: u8, const B: u8>(
&self,
) -> FgColorDisplay<'_, CustomColor<R, G, B>, Self>
fn fg_rgb<const R: u8, const G: u8, const B: u8>( &self, ) -> FgColorDisplay<'_, CustomColor<R, G, B>, Self>
§fn bg_rgb<const R: u8, const G: u8, const B: u8>(
&self,
) -> BgColorDisplay<'_, CustomColor<R, G, B>, Self>
fn bg_rgb<const R: u8, const G: u8, const B: u8>( &self, ) -> BgColorDisplay<'_, CustomColor<R, G, B>, Self>
§fn truecolor(&self, r: u8, g: u8, b: u8) -> FgDynColorDisplay<'_, Rgb, Self>
fn truecolor(&self, r: u8, g: u8, b: u8) -> FgDynColorDisplay<'_, Rgb, Self>
§fn on_truecolor(&self, r: u8, g: u8, b: u8) -> BgDynColorDisplay<'_, Rgb, Self>
fn on_truecolor(&self, r: u8, g: u8, b: u8) -> BgDynColorDisplay<'_, Rgb, Self>
§impl<T> Pipe for Twhere
T: ?Sized,
impl<T> Pipe for Twhere
T: ?Sized,
§fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> Rwhere
Self: Sized,
fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> Rwhere
Self: Sized,
§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 more§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 more§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
§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
§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.§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.§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.§impl<T> Pointable for T
impl<T> Pointable for T
source§impl<Response, Error> ResponseResult<Response, Error> for Response
impl<Response, Error> ResponseResult<Response, Error> for Response
source§fn into_result(self) -> Result<Response, Error>
fn into_result(self) -> Result<Response, Error>
Result
that can be sent as a response.§impl<T, Request> ServiceExt<Request> for Twhere
T: Service<Request> + ?Sized,
impl<T, Request> ServiceExt<Request> for Twhere
T: Service<Request> + ?Sized,
§fn ready(&mut self) -> Ready<'_, Self, Request>where
Self: Sized,
fn ready(&mut self) -> Ready<'_, Self, Request>where
Self: Sized,
§fn ready_and(&mut self) -> Ready<'_, Self, Request>where
Self: Sized,
fn ready_and(&mut self) -> Ready<'_, Self, Request>where
Self: Sized,
ServiceExt::ready
method instead§fn ready_oneshot(self) -> ReadyOneshot<Self, Request>where
Self: Sized,
fn ready_oneshot(self) -> ReadyOneshot<Self, Request>where
Self: Sized,
§fn oneshot(self, req: Request) -> Oneshot<Self, Request>where
Self: Sized,
fn oneshot(self, req: Request) -> Oneshot<Self, Request>where
Self: Sized,
Service
, calling with the providing request once it is ready.§fn and_then<F>(self, f: F) -> AndThen<Self, F>
fn and_then<F>(self, f: F) -> AndThen<Self, F>
poll_ready
method. Read more§fn map_response<F, Response>(self, f: F) -> MapResponse<Self, F>
fn map_response<F, Response>(self, f: F) -> MapResponse<Self, F>
poll_ready
method. Read more§fn map_err<F, Error>(self, f: F) -> MapErr<Self, F>
fn map_err<F, Error>(self, f: F) -> MapErr<Self, F>
poll_ready
method. Read more§fn map_result<F, Response, Error>(self, f: F) -> MapResult<Self, F>
fn map_result<F, Response, Error>(self, f: F) -> MapResult<Self, F>
Result<Self::Response, Self::Error>
)
to a different value, regardless of whether the future succeeds or
fails. Read more§fn map_request<F, NewRequest>(self, f: F) -> MapRequest<Self, F>
fn map_request<F, NewRequest>(self, f: F) -> MapRequest<Self, F>
§fn filter<F, NewRequest>(self, filter: F) -> Filter<Self, F>where
Self: Sized,
F: Predicate<NewRequest>,
fn filter<F, NewRequest>(self, filter: F) -> Filter<Self, F>where
Self: Sized,
F: Predicate<NewRequest>,
§fn filter_async<F, NewRequest>(self, filter: F) -> AsyncFilter<Self, F>where
Self: Sized,
F: AsyncPredicate<NewRequest>,
fn filter_async<F, NewRequest>(self, filter: F) -> AsyncFilter<Self, F>where
Self: Sized,
F: AsyncPredicate<NewRequest>,
AsyncFilter
that conditionally accepts or
rejects requests based on an [async predicate]. Read more§fn then<F, Response, Error, Fut>(self, f: F) -> Then<Self, F>
fn then<F, Response, Error, Fut>(self, f: F) -> Then<Self, F>
§fn map_future<F, Fut, Response, Error>(self, f: F) -> MapFuture<Self, F>
fn map_future<F, Fut, Response, Error>(self, f: F) -> MapFuture<Self, F>
§impl<T> Tap for T
impl<T> Tap for T
§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 more§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 more§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 more§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 more§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 more§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 more§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.§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.§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.§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.§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.§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.§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.