Struct zebra_network::address_book::AddressBook
source · pub struct AddressBook {
by_addr: OrderedMap<PeerSocketAddr, MetaAddr, Reverse<MetaAddr>>,
most_recent_by_ip: Option<HashMap<IpAddr, MetaAddr>>,
local_listener: SocketAddr,
network: Network,
addr_limit: usize,
span: Span,
address_metrics_tx: Sender<AddressMetrics>,
last_address_log: Option<Instant>,
}
Expand description
A database of peer listener addresses, their advertised services, and information on when they were last seen.
§Security
Address book state must be based on outbound connections to peers.
If the address book is updated incorrectly:
- malicious peers can interfere with other peers’
AddressBook
state, or - Zebra can advertise unreachable addresses to its own peers.
§Adding Addresses
The address book should only contain Zcash listener port addresses from peers on the configured network. These addresses can come from:
- DNS seeders
- addresses gossiped by other peers
- the canonical address (
Version.address_from
) provided by each peer, particularly peers on inbound connections.
The remote addresses of inbound connections must not be added to the address book, because they contain ephemeral outbound ports, not listener ports.
Isolated connections must not add addresses or update the address book.
§Updating Address State
Updates to address state must be based on outbound connections to peers.
Updates must not be based on:
- the remote addresses of inbound connections, or
- the canonical address of any connection.
Fields§
§by_addr: OrderedMap<PeerSocketAddr, MetaAddr, Reverse<MetaAddr>>
Peer listener addresses, suitable for outbound connections, in connection attempt order.
Some peers in this list might have open outbound or inbound connections.
We reverse the comparison order, because the standard library
(BTreeMap
) sorts in ascending order, but
[OrderedMap
] sorts in descending order.
most_recent_by_ip: Option<HashMap<IpAddr, MetaAddr>>
The address with a last_connection_state of PeerAddrState::Responded
and
the most recent last_response
time by IP.
This is used to avoid initiating outbound connections past Config::max_connections_per_ip
, and
currently only supports a max_connections_per_ip
of 1, and must be None
when used with a greater max_connections_per_ip
.
local_listener: SocketAddr
The local listener address.
network: Network
The configured Zcash network.
addr_limit: usize
The maximum number of addresses in the address book.
Always set to MAX_ADDRS_IN_ADDRESS_BOOK
,
in release builds. Lower values are used during testing.
span: Span
The span for operations on this address book.
address_metrics_tx: Sender<AddressMetrics>
A channel used to send the latest address book metrics.
last_address_log: Option<Instant>
The last time we logged a message about the address metrics.
Implementations§
source§impl AddressBook
impl AddressBook
sourcepub fn new(
local_listener: SocketAddr,
network: &Network,
max_connections_per_ip: usize,
span: Span,
) -> AddressBook
pub fn new( local_listener: SocketAddr, network: &Network, max_connections_per_ip: usize, span: Span, ) -> AddressBook
Construct an AddressBook
with the given local_listener
on network
.
Uses the supplied [tracing::Span
] for address book operations.
sourcepub fn new_with_addrs(
local_listener: SocketAddr,
network: &Network,
max_connections_per_ip: usize,
addr_limit: usize,
span: Span,
addrs: impl IntoIterator<Item = MetaAddr>,
) -> AddressBook
pub fn new_with_addrs( local_listener: SocketAddr, network: &Network, max_connections_per_ip: usize, addr_limit: usize, span: Span, addrs: impl IntoIterator<Item = MetaAddr>, ) -> AddressBook
Construct an AddressBook
with the given local_listener
, network
,
addr_limit
, [tracing::Span
], and addresses.
addr_limit
is enforced by this method, and by AddressBook::update
.
If there are multiple MetaAddr
s with the same address,
an arbitrary address is inserted into the address book,
and the rest are dropped.
This constructor can be used to break address book invariants, so it should only be used in tests.
sourcepub fn address_metrics_watcher(&self) -> Receiver<AddressMetrics>
pub fn address_metrics_watcher(&self) -> Receiver<AddressMetrics>
Return a watch channel for the address book metrics.
The metrics in the watch channel are only updated when the address book updates, so they can be significantly outdated if Zebra is disconnected or hung.
The current metrics value is marked as seen.
So Receiver::changed
will only return after the next address book update.
sourcepub fn set_local_listener(&mut self, addr: SocketAddr)
pub fn set_local_listener(&mut self, addr: SocketAddr)
Set the local listener address. Only for use in tests.
sourcepub fn local_listener_meta_addr(&self, now: DateTime<Utc>) -> MetaAddr
pub fn local_listener_meta_addr(&self, now: DateTime<Utc>) -> MetaAddr
Get the local listener address.
This address contains minimal state, but it is not sanitized.
sourcepub fn local_listener_socket_addr(&self) -> SocketAddr
pub fn local_listener_socket_addr(&self) -> SocketAddr
Get the local listener SocketAddr
.
sourcepub fn fresh_get_addr_response(&self) -> Vec<MetaAddr>
pub fn fresh_get_addr_response(&self) -> Vec<MetaAddr>
Get the active addresses in self
in random order with sanitized timestamps,
including our local listener address.
Limited to a the number of peer addresses Zebra should give out per GetAddr
request.
sourcepub(crate) fn sanitized(&self, now: DateTime<Utc>) -> Vec<MetaAddr>
pub(crate) fn sanitized(&self, now: DateTime<Utc>) -> Vec<MetaAddr>
Get the active addresses in self
in random order with sanitized timestamps,
including our local listener address.
sourcepub fn cacheable(&self, now: DateTime<Utc>) -> Vec<MetaAddr>
pub fn cacheable(&self, now: DateTime<Utc>) -> Vec<MetaAddr>
Get the active addresses in self
, in preferred caching order,
excluding our local listener address.
sourcepub fn get(&mut self, addr: PeerSocketAddr) -> Option<MetaAddr>
pub fn get(&mut self, addr: PeerSocketAddr) -> Option<MetaAddr>
Look up addr
in the address book, and return its MetaAddr
.
Converts addr
to a canonical address before looking it up.
sourcefn should_update_most_recent_by_ip(&self, updated: MetaAddr) -> bool
fn should_update_most_recent_by_ip(&self, updated: MetaAddr) -> bool
Returns true if updated
needs to be applied to the recent outbound peer connection IP cache.
Checks if there are no existing entries in the address book with this IP,
or if updated
has a more recent last_response
requiring the outbound connector to wait
longer before initiating handshakes with peers at this IP.
This code only needs to check a single cache entry, rather than the entire address book, because other code maintains these invariants:
last_response
times for an entry can only increase.- this is the only field checked by
has_connection_recently_responded()
See AddressBook::is_ready_for_connection_attempt_with_ip
for more details.
sourcefn should_remove_most_recent_by_ip(&self, addr: PeerSocketAddr) -> bool
fn should_remove_most_recent_by_ip(&self, addr: PeerSocketAddr) -> bool
Returns true if addr
is the latest entry for its IP, which is stored in most_recent_by_ip
.
The entry is checked for an exact match to the IP and port of addr
.
sourcepub fn update(&mut self, change: MetaAddrChange) -> Option<MetaAddr>
pub fn update(&mut self, change: MetaAddrChange) -> Option<MetaAddr>
Apply change
to the address book, returning the updated MetaAddr
,
if the change was valid.
§Correctness
All changes should go through update
, so that the address book
only contains valid outbound addresses.
Change addresses must be canonical PeerSocketAddr
s. This makes sure that
each address book entry has a unique IP address.
§Security
This function must apply every attempted, responded, and failed change to the address book. This prevents rapid reconnections to the same peer.
As an exception, this function can ignore all changes for specific
PeerSocketAddr
s. Ignored addresses will never be used to connect to
peers.
sourcefn take(&mut self, removed_addr: PeerSocketAddr) -> Option<MetaAddr>
fn take(&mut self, removed_addr: PeerSocketAddr) -> Option<MetaAddr>
Removes the entry with addr
, returning it if it exists
§Note
All address removals should go through take
, so that the address
book metrics are accurate.
sourcepub fn pending_reconnection_addr(&mut self, addr: PeerSocketAddr) -> bool
pub fn pending_reconnection_addr(&mut self, addr: PeerSocketAddr) -> bool
Returns true if the given PeerSocketAddr
is pending a reconnection
attempt.
sourcepub fn peers(&self) -> impl DoubleEndedIterator<Item = MetaAddr> + '_
pub fn peers(&self) -> impl DoubleEndedIterator<Item = MetaAddr> + '_
Return an iterator over all peers.
Returns peers in reconnection attempt order, including recently connected peers.
sourcefn is_ready_for_connection_attempt_with_ip(
&self,
ip: &IpAddr,
chrono_now: DateTime<Utc>,
) -> bool
fn is_ready_for_connection_attempt_with_ip( &self, ip: &IpAddr, chrono_now: DateTime<Utc>, ) -> bool
Is this IP ready for a new outbound connection attempt? Checks if the outbound connection with the most recent response at this IP has recently responded.
Note: last_response times may remain live for a long time if the local clock is changed to an earlier time.
sourcepub fn reconnection_peers(
&self,
instant_now: Instant,
chrono_now: DateTime<Utc>,
) -> impl DoubleEndedIterator<Item = MetaAddr> + '_
pub fn reconnection_peers( &self, instant_now: Instant, chrono_now: DateTime<Utc>, ) -> impl DoubleEndedIterator<Item = MetaAddr> + '_
Return an iterator over peers that are due for a reconnection attempt, in reconnection attempt order.
sourcepub fn state_peers(
&self,
state: PeerAddrState,
) -> impl DoubleEndedIterator<Item = MetaAddr> + '_
pub fn state_peers( &self, state: PeerAddrState, ) -> impl DoubleEndedIterator<Item = MetaAddr> + '_
Return an iterator over all the peers in state
,
in reconnection attempt order, including recently connected peers.
sourcepub fn maybe_connected_peers(
&self,
instant_now: Instant,
chrono_now: DateTime<Utc>,
) -> impl DoubleEndedIterator<Item = MetaAddr> + '_
pub fn maybe_connected_peers( &self, instant_now: Instant, chrono_now: DateTime<Utc>, ) -> impl DoubleEndedIterator<Item = MetaAddr> + '_
Return an iterator over peers that might be connected, in reconnection attempt order.
sourcefn address_metrics_internal(&self, now: DateTime<Utc>) -> AddressMetrics
fn address_metrics_internal(&self, now: DateTime<Utc>) -> AddressMetrics
Returns metrics for the addresses in this address book.
§Correctness
External callers should use [AddressBook::address_metrics_watcher().borrow()
]
in production code, to avoid deadlocks.
(Using the watch channel receiver does not lock the address book mutex.)
sourcefn update_metrics(&mut self, instant_now: Instant, chrono_now: DateTime<Utc>)
fn update_metrics(&mut self, instant_now: Instant, chrono_now: DateTime<Utc>)
Update the metrics for this address book.
sourcefn log_metrics(&mut self, m: &AddressMetrics, now: Instant)
fn log_metrics(&mut self, m: &AddressMetrics, now: Instant)
Log metrics for this address book
Trait Implementations§
source§impl AddressBookPeers for AddressBook
impl AddressBookPeers for AddressBook
source§impl Clone for AddressBook
impl Clone for AddressBook
source§fn clone(&self) -> AddressBook
fn clone(&self) -> AddressBook
Clone the addresses, address limit, local listener address, and span.
Cloned address books have a separate metrics struct watch channel, and an empty last address log.
All address books update the same prometheus metrics.
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moresource§impl Debug for AddressBook
impl Debug for AddressBook
source§impl Extend<MetaAddrChange> for AddressBook
impl Extend<MetaAddrChange> for AddressBook
source§fn extend<T>(&mut self, iter: T)where
T: IntoIterator<Item = MetaAddrChange>,
fn extend<T>(&mut self, iter: T)where
T: IntoIterator<Item = MetaAddrChange>,
source§fn extend_one(&mut self, item: A)
fn extend_one(&mut self, item: A)
extend_one
)source§fn extend_reserve(&mut self, additional: usize)
fn extend_reserve(&mut self, additional: usize)
extend_one
)Auto Trait Implementations§
impl Freeze for AddressBook
impl !RefUnwindSafe for AddressBook
impl Send for AddressBook
impl Sync for AddressBook
impl Unpin for AddressBook
impl !UnwindSafe for AddressBook
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§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)§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 more§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> 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.