Struct sn_networking::Network
source · pub struct Network {
pub swarm_cmd_sender: Sender<SwarmCmd>,
pub peer_id: Arc<PeerId>,
pub root_dir_path: Arc<PathBuf>,
/* private fields */
}
Expand description
API to interact with the underlying Swarm
Fields§
§swarm_cmd_sender: Sender<SwarmCmd>
§peer_id: Arc<PeerId>
§root_dir_path: Arc<PathBuf>
Implementations§
source§impl Network
impl Network
sourcepub async fn verify_spend(
&self,
spend: &SignedSpend
) -> Result<(), NetworkError>
pub async fn verify_spend( &self, spend: &SignedSpend ) -> Result<(), NetworkError>
This function verifies a single spend. This is used by nodes for spends validation, before storing them.
- It checks if the spend has valid ancestry, that its parents exist on the Network
- It checks that the spend has a valid signature and content
- It does NOT check if the spend exists online
- It does NOT check if the spend is already spent on the Network
source§impl Network
impl Network
sourcepub async fn get_raw_spends(
&self,
address: SpendAddress
) -> Result<Vec<SignedSpend>, NetworkError>
pub async fn get_raw_spends( &self, address: SpendAddress ) -> Result<Vec<SignedSpend>, NetworkError>
Gets raw spends from the Network.
For normal use please prefer using get_spend
instead.
Double spends returned together as is, not as an error.
The target may have high chance not present in the network yet.
If we get a quorum error, we enable re-try
sourcepub async fn get_spend(
&self,
address: SpendAddress
) -> Result<SignedSpend, NetworkError>
pub async fn get_spend( &self, address: SpendAddress ) -> Result<SignedSpend, NetworkError>
Gets a spend from the Network. We know it must be there, and has to be fetched from Quorum::All
If we get a quorum error, we increase the RetryStrategy
sourcepub async fn verify_and_unpack_transfer(
&self,
transfer: &Transfer,
wallet: &HotWallet
) -> Result<Vec<CashNote>, NetworkError>
pub async fn verify_and_unpack_transfer( &self, transfer: &Transfer, wallet: &HotWallet ) -> Result<Vec<CashNote>, NetworkError>
This function is used to receive a Transfer and turn it back into spendable CashNotes.
Needs Network connection.
Verify Transfer and rebuild spendable currency from it
Returns an Error::FailedToDecypherTransfer
if the transfer cannot be decyphered
(This means the transfer is not for us as it was not encrypted to our key)
Returns an Error::InvalidTransfer
if the transfer is not valid
Else returns a list of CashNotes that can be deposited to our wallet and spent
sourcepub async fn verify_cash_notes_redemptions(
&self,
main_pubkey: MainPubkey,
cashnote_redemptions: &[CashNoteRedemption]
) -> Result<Vec<CashNote>, NetworkError>
pub async fn verify_cash_notes_redemptions( &self, main_pubkey: MainPubkey, cashnote_redemptions: &[CashNoteRedemption] ) -> Result<Vec<CashNote>, NetworkError>
This function is used to receive a list of CashNoteRedemptions and turn it back into spendable CashNotes.
Needs Network connection.
Verify CashNoteRedemptions and rebuild spendable currency from them.
Returns an Error::InvalidTransfer
if any CashNoteRedemption is not valid
Else returns a list of CashNotes that can be spent by the owner.
source§impl Network
impl Network
sourcepub fn sign(&self, msg: &[u8]) -> Result<Vec<u8>, NetworkError>
pub fn sign(&self, msg: &[u8]) -> Result<Vec<u8>, NetworkError>
Signs the given data with the node’s keypair.
sourcepub fn verify(&self, msg: &[u8], sig: &[u8]) -> bool
pub fn verify(&self, msg: &[u8], sig: &[u8]) -> bool
Verifies a signature for the given data and the node’s public key.
sourcepub fn get_pub_key(&self) -> Vec<u8> ⓘ
pub fn get_pub_key(&self) -> Vec<u8> ⓘ
Returns the protobuf serialised PublicKey to allow messaging out for share.
sourcepub async fn dial(&self, addr: Multiaddr) -> Result<(), NetworkError>
pub async fn dial(&self, addr: Multiaddr) -> Result<(), NetworkError>
Dial the given peer at the given address. This function will only be called for the bootstrap nodes.
sourcepub async fn client_get_closest_peers(
&self,
key: &NetworkAddress
) -> Result<Vec<PeerId>, NetworkError>
pub async fn client_get_closest_peers( &self, key: &NetworkAddress ) -> Result<Vec<PeerId>, NetworkError>
Returns the closest peers to the given XorName
, sorted by their distance to the xor_name.
Excludes the client’s PeerId
while calculating the closest peers.
sourcepub async fn node_get_closest_peers(
&self,
key: &NetworkAddress
) -> Result<Vec<PeerId>, NetworkError>
pub async fn node_get_closest_peers( &self, key: &NetworkAddress ) -> Result<Vec<PeerId>, NetworkError>
Returns the closest peers to the given NetworkAddress
, sorted by their distance to the key.
Includes our node’s PeerId
while calculating the closest peers.
sourcepub async fn get_kbuckets(
&self
) -> Result<BTreeMap<u32, Vec<PeerId>>, NetworkError>
pub async fn get_kbuckets( &self ) -> Result<BTreeMap<u32, Vec<PeerId>>, NetworkError>
Returns a map where each key is the ilog2 distance of that Kbucket and each value is a vector of peers in that bucket. Does not include self
sourcepub async fn get_close_group_local_peers(
&self,
key: &NetworkAddress
) -> Result<Vec<PeerId>, NetworkError>
pub async fn get_close_group_local_peers( &self, key: &NetworkAddress ) -> Result<Vec<PeerId>, NetworkError>
Returns the closest peers to the given NetworkAddress
that is fetched from the local
Routing Table. It is ordered by increasing distance of the peers
Note self peer_id is not included in the result.
sourcepub async fn get_all_local_peers(&self) -> Result<Vec<PeerId>, NetworkError>
pub async fn get_all_local_peers(&self) -> Result<Vec<PeerId>, NetworkError>
Returns all the PeerId from all the KBuckets from our local Routing Table Also contains our own PeerId.
sourcepub async fn get_closest_k_value_local_peers(
&self
) -> Result<Vec<PeerId>, NetworkError>
pub async fn get_closest_k_value_local_peers( &self ) -> Result<Vec<PeerId>, NetworkError>
Returns all the PeerId from all the KBuckets from our local Routing Table Also contains our own PeerId.
sourcepub async fn verify_chunk_existence(
&self,
chunk_address: NetworkAddress,
nonce: Nonce,
expected_proof: ChunkProof,
quorum: Quorum,
retry_strategy: Option<RetryStrategy>
) -> Result<(), NetworkError>
pub async fn verify_chunk_existence( &self, chunk_address: NetworkAddress, nonce: Nonce, expected_proof: ChunkProof, quorum: Quorum, retry_strategy: Option<RetryStrategy> ) -> Result<(), NetworkError>
Get the Chunk existence proof from the close nodes to the provided chunk address.
sourcepub async fn get_store_costs_from_network(
&self,
record_address: NetworkAddress,
ignore_peers: Vec<PeerId>
) -> Result<PayeeQuote, NetworkError>
pub async fn get_store_costs_from_network( &self, record_address: NetworkAddress, ignore_peers: Vec<PeerId> ) -> Result<PayeeQuote, NetworkError>
Get the store costs from the majority of the closest peers to the provided RecordKey. Record already exists will have a cost of zero to be returned.
Ignore the quote from any peers from ignore_peers
. This is useful if we want to repay a different PeerId
on failure.
sourcepub async fn get_record_from_network(
&self,
key: RecordKey,
cfg: &GetRecordCfg
) -> Result<Record, NetworkError>
pub async fn get_record_from_network( &self, key: RecordKey, cfg: &GetRecordCfg ) -> Result<Record, NetworkError>
Get the Record from the network Carry out re-attempts if required In case a target_record is provided, only return when fetched target. Otherwise count it as a failure when all attempts completed.
sourcepub async fn get_local_storecost(
&self,
key: RecordKey
) -> Result<(NanoTokens, QuotingMetrics), NetworkError>
pub async fn get_local_storecost( &self, key: RecordKey ) -> Result<(NanoTokens, QuotingMetrics), NetworkError>
Get the cost of storing the next record from the network
sourcepub fn notify_payment_received(&self)
pub fn notify_payment_received(&self)
Notify the node receicced a payment.
sourcepub async fn get_local_record(
&self,
key: &RecordKey
) -> Result<Option<Record>, NetworkError>
pub async fn get_local_record( &self, key: &RecordKey ) -> Result<Option<Record>, NetworkError>
Get Record
from the local RecordStore
sourcepub async fn is_peer_shunned(
&self,
target: NetworkAddress
) -> Result<bool, NetworkError>
pub async fn is_peer_shunned( &self, target: NetworkAddress ) -> Result<bool, NetworkError>
Whether the target peer is considered blacklisted by self
sourcepub async fn put_record(
&self,
record: Record,
cfg: &PutRecordCfg
) -> Result<(), NetworkError>
pub async fn put_record( &self, record: Record, cfg: &PutRecordCfg ) -> Result<(), NetworkError>
Put Record
to network
Optionally verify the record is stored after putting it to network
If verify is on, retry multiple times within MAX_PUT_RETRY_DURATION duration.
sourcepub fn put_local_record(&self, record: Record)
pub fn put_local_record(&self, record: Record)
Put Record
to the local RecordStore
Must be called after the validations are performed on the Record
sourcepub async fn is_record_key_present_locally(
&self,
key: &RecordKey
) -> Result<bool, NetworkError>
pub async fn is_record_key_present_locally( &self, key: &RecordKey ) -> Result<bool, NetworkError>
Returns true if a RecordKey is present locally in the RecordStore
sourcepub async fn get_all_local_record_addresses(
&self
) -> Result<HashMap<NetworkAddress, RecordType>, NetworkError>
pub async fn get_all_local_record_addresses( &self ) -> Result<HashMap<NetworkAddress, RecordType>, NetworkError>
Returns the Addresses of all the locally stored Records
sourcepub async fn send_request(
&self,
req: Request,
peer: PeerId
) -> Result<Response, NetworkError>
pub async fn send_request( &self, req: Request, peer: PeerId ) -> Result<Response, NetworkError>
Send Request
to the given PeerId
and await for the response. If self
is the recipient,
then the Request
is forwarded to itself and handled, and a corresponding Response
is created
and returned to itself. Hence the flow remains the same and there is no branching at the upper
layers.
sourcepub fn send_req_ignore_reply(&self, req: Request, peer: PeerId)
pub fn send_req_ignore_reply(&self, req: Request, peer: PeerId)
Send Request
to the given PeerId
and do not await a response here.
Instead the Response will be handled by the common response_handler
sourcepub fn send_response(&self, resp: Response, channel: MsgResponder)
pub fn send_response(&self, resp: Response, channel: MsgResponder)
Send a Response
through the channel opened by the requester.
sourcepub async fn get_swarm_local_state(
&self
) -> Result<SwarmLocalState, NetworkError>
pub async fn get_swarm_local_state( &self ) -> Result<SwarmLocalState, NetworkError>
Return a SwarmLocalState
with some information obtained from swarm’s local state.
pub fn trigger_interval_replication(&self)
pub fn record_node_issues(&self, peer_id: PeerId, issue: NodeIssue)
pub fn historical_verify_quotes(&self, quotes: Vec<(PeerId, PaymentQuote)>)
sourcepub async fn get_closest_peers(
&self,
key: &NetworkAddress,
client: bool
) -> Result<Vec<PeerId>, NetworkError>
pub async fn get_closest_peers( &self, key: &NetworkAddress, client: bool ) -> Result<Vec<PeerId>, NetworkError>
Returns the closest peers to the given XorName
, sorted by their distance to the xor_name.
If client
is false, then include self
among the closest_peers
sourcepub async fn send_and_get_responses(
&self,
peers: &[PeerId],
req: &Request,
get_all_responses: bool
) -> BTreeMap<PeerId, Result<Response, NetworkError>>
pub async fn send_and_get_responses( &self, peers: &[PeerId], req: &Request, get_all_responses: bool ) -> BTreeMap<PeerId, Result<Response, NetworkError>>
Send a Request
to the provided set of peers and wait for their responses concurrently.
If get_all_responses
is true, we wait for the responses from all the peers.
NB TODO: Will return an error if the request timeouts.
If get_all_responses
is false, we return the first successful response that we get
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Network
impl !RefUnwindSafe for Network
impl Send for Network
impl Sync for Network
impl Unpin for Network
impl !UnwindSafe for Network
Blanket Implementations§
source§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
source§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
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> 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> 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<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<'a>(&'a self) -> FgColorDisplay<'a, Black, Self>
fn black<'a>(&'a self) -> FgColorDisplay<'a, Black, Self>
source§fn on_black<'a>(&'a self) -> BgColorDisplay<'a, Black, Self>
fn on_black<'a>(&'a self) -> BgColorDisplay<'a, Black, Self>
source§fn red<'a>(&'a self) -> FgColorDisplay<'a, Red, Self>
fn red<'a>(&'a self) -> FgColorDisplay<'a, Red, Self>
source§fn on_red<'a>(&'a self) -> BgColorDisplay<'a, Red, Self>
fn on_red<'a>(&'a self) -> BgColorDisplay<'a, Red, Self>
source§fn green<'a>(&'a self) -> FgColorDisplay<'a, Green, Self>
fn green<'a>(&'a self) -> FgColorDisplay<'a, Green, Self>
source§fn on_green<'a>(&'a self) -> BgColorDisplay<'a, Green, Self>
fn on_green<'a>(&'a self) -> BgColorDisplay<'a, Green, Self>
source§fn yellow<'a>(&'a self) -> FgColorDisplay<'a, Yellow, Self>
fn yellow<'a>(&'a self) -> FgColorDisplay<'a, Yellow, Self>
source§fn on_yellow<'a>(&'a self) -> BgColorDisplay<'a, Yellow, Self>
fn on_yellow<'a>(&'a self) -> BgColorDisplay<'a, Yellow, Self>
source§fn blue<'a>(&'a self) -> FgColorDisplay<'a, Blue, Self>
fn blue<'a>(&'a self) -> FgColorDisplay<'a, Blue, Self>
source§fn on_blue<'a>(&'a self) -> BgColorDisplay<'a, Blue, Self>
fn on_blue<'a>(&'a self) -> BgColorDisplay<'a, Blue, Self>
source§fn magenta<'a>(&'a self) -> FgColorDisplay<'a, Magenta, Self>
fn magenta<'a>(&'a self) -> FgColorDisplay<'a, Magenta, Self>
source§fn on_magenta<'a>(&'a self) -> BgColorDisplay<'a, Magenta, Self>
fn on_magenta<'a>(&'a self) -> BgColorDisplay<'a, Magenta, Self>
source§fn purple<'a>(&'a self) -> FgColorDisplay<'a, Magenta, Self>
fn purple<'a>(&'a self) -> FgColorDisplay<'a, Magenta, Self>
source§fn on_purple<'a>(&'a self) -> BgColorDisplay<'a, Magenta, Self>
fn on_purple<'a>(&'a self) -> BgColorDisplay<'a, Magenta, Self>
source§fn cyan<'a>(&'a self) -> FgColorDisplay<'a, Cyan, Self>
fn cyan<'a>(&'a self) -> FgColorDisplay<'a, Cyan, Self>
source§fn on_cyan<'a>(&'a self) -> BgColorDisplay<'a, Cyan, Self>
fn on_cyan<'a>(&'a self) -> BgColorDisplay<'a, Cyan, Self>
source§fn white<'a>(&'a self) -> FgColorDisplay<'a, White, Self>
fn white<'a>(&'a self) -> FgColorDisplay<'a, White, Self>
source§fn on_white<'a>(&'a self) -> BgColorDisplay<'a, White, Self>
fn on_white<'a>(&'a self) -> BgColorDisplay<'a, White, Self>
source§fn default_color<'a>(&'a self) -> FgColorDisplay<'a, Default, Self>
fn default_color<'a>(&'a self) -> FgColorDisplay<'a, Default, Self>
source§fn on_default_color<'a>(&'a self) -> BgColorDisplay<'a, Default, Self>
fn on_default_color<'a>(&'a self) -> BgColorDisplay<'a, Default, Self>
source§fn bright_black<'a>(&'a self) -> FgColorDisplay<'a, BrightBlack, Self>
fn bright_black<'a>(&'a self) -> FgColorDisplay<'a, BrightBlack, Self>
source§fn on_bright_black<'a>(&'a self) -> BgColorDisplay<'a, BrightBlack, Self>
fn on_bright_black<'a>(&'a self) -> BgColorDisplay<'a, BrightBlack, Self>
source§fn bright_red<'a>(&'a self) -> FgColorDisplay<'a, BrightRed, Self>
fn bright_red<'a>(&'a self) -> FgColorDisplay<'a, BrightRed, Self>
source§fn on_bright_red<'a>(&'a self) -> BgColorDisplay<'a, BrightRed, Self>
fn on_bright_red<'a>(&'a self) -> BgColorDisplay<'a, BrightRed, Self>
source§fn bright_green<'a>(&'a self) -> FgColorDisplay<'a, BrightGreen, Self>
fn bright_green<'a>(&'a self) -> FgColorDisplay<'a, BrightGreen, Self>
source§fn on_bright_green<'a>(&'a self) -> BgColorDisplay<'a, BrightGreen, Self>
fn on_bright_green<'a>(&'a self) -> BgColorDisplay<'a, BrightGreen, Self>
source§fn bright_yellow<'a>(&'a self) -> FgColorDisplay<'a, BrightYellow, Self>
fn bright_yellow<'a>(&'a self) -> FgColorDisplay<'a, BrightYellow, Self>
source§fn on_bright_yellow<'a>(&'a self) -> BgColorDisplay<'a, BrightYellow, Self>
fn on_bright_yellow<'a>(&'a self) -> BgColorDisplay<'a, BrightYellow, Self>
source§fn bright_blue<'a>(&'a self) -> FgColorDisplay<'a, BrightBlue, Self>
fn bright_blue<'a>(&'a self) -> FgColorDisplay<'a, BrightBlue, Self>
source§fn on_bright_blue<'a>(&'a self) -> BgColorDisplay<'a, BrightBlue, Self>
fn on_bright_blue<'a>(&'a self) -> BgColorDisplay<'a, BrightBlue, Self>
source§fn bright_magenta<'a>(&'a self) -> FgColorDisplay<'a, BrightMagenta, Self>
fn bright_magenta<'a>(&'a self) -> FgColorDisplay<'a, BrightMagenta, Self>
source§fn on_bright_magenta<'a>(&'a self) -> BgColorDisplay<'a, BrightMagenta, Self>
fn on_bright_magenta<'a>(&'a self) -> BgColorDisplay<'a, BrightMagenta, Self>
source§fn bright_purple<'a>(&'a self) -> FgColorDisplay<'a, BrightMagenta, Self>
fn bright_purple<'a>(&'a self) -> FgColorDisplay<'a, BrightMagenta, Self>
source§fn on_bright_purple<'a>(&'a self) -> BgColorDisplay<'a, BrightMagenta, Self>
fn on_bright_purple<'a>(&'a self) -> BgColorDisplay<'a, BrightMagenta, Self>
source§fn bright_cyan<'a>(&'a self) -> FgColorDisplay<'a, BrightCyan, Self>
fn bright_cyan<'a>(&'a self) -> FgColorDisplay<'a, BrightCyan, Self>
source§fn on_bright_cyan<'a>(&'a self) -> BgColorDisplay<'a, BrightCyan, Self>
fn on_bright_cyan<'a>(&'a self) -> BgColorDisplay<'a, BrightCyan, Self>
source§fn bright_white<'a>(&'a self) -> FgColorDisplay<'a, BrightWhite, Self>
fn bright_white<'a>(&'a self) -> FgColorDisplay<'a, BrightWhite, Self>
source§fn on_bright_white<'a>(&'a self) -> BgColorDisplay<'a, BrightWhite, Self>
fn on_bright_white<'a>(&'a self) -> BgColorDisplay<'a, BrightWhite, Self>
source§fn bold<'a>(&'a self) -> BoldDisplay<'a, Self>
fn bold<'a>(&'a self) -> BoldDisplay<'a, Self>
source§fn dimmed<'a>(&'a self) -> DimDisplay<'a, Self>
fn dimmed<'a>(&'a self) -> DimDisplay<'a, Self>
source§fn italic<'a>(&'a self) -> ItalicDisplay<'a, Self>
fn italic<'a>(&'a self) -> ItalicDisplay<'a, Self>
source§fn underline<'a>(&'a self) -> UnderlineDisplay<'a, Self>
fn underline<'a>(&'a self) -> UnderlineDisplay<'a, Self>
source§fn blink<'a>(&'a self) -> BlinkDisplay<'a, Self>
fn blink<'a>(&'a self) -> BlinkDisplay<'a, Self>
source§fn blink_fast<'a>(&'a self) -> BlinkFastDisplay<'a, Self>
fn blink_fast<'a>(&'a self) -> BlinkFastDisplay<'a, Self>
source§fn reversed<'a>(&'a self) -> ReversedDisplay<'a, Self>
fn reversed<'a>(&'a self) -> ReversedDisplay<'a, Self>
source§fn strikethrough<'a>(&'a self) -> StrikeThroughDisplay<'a, Self>
fn strikethrough<'a>(&'a self) -> StrikeThroughDisplay<'a, 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 moresource§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>
source§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>
source§fn truecolor(&self, r: u8, g: u8, b: u8) -> FgDynColorDisplay<'_, Rgb, Self>
fn truecolor(&self, r: u8, g: u8, b: u8) -> FgDynColorDisplay<'_, Rgb, Self>
source§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>
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> 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.