Skip to main content

Client

Struct Client 

Source
pub struct Client { /* private fields */ }
Expand description

A gRPC client for the Sui fullnode RPC interface.

RPCs made through a client and its clones are multiplexed over a single HTTP/2 connection by default; see with_num_connections to spread them over several.

§Ledger streams

Client provides two styles of stream operations for checkpoints, transactions, and events:

Stream read masks must include sequence_number for checkpoints; checkpoint and transaction_index for transactions; and checkpoint, transaction_index, and event_index for events ("*" satisfies all three).

Process a payload before persisting its restart position. To resume after a checkpoint, pass cursor + 1 to CheckpointStreamStart::Checkpoint. To resume transactions or events, pass frame.cursor to TransactionStreamStart::Resume or EventStreamStart::Resume.

§Example

let client = Client::new(Client::MAINNET_FULLNODE)?;
let read_mask = FieldMask::from_paths(["checkpoint", "transaction_index", "digest"]);
let request = TransactionStreamRequest::new().with_read_mask(read_mask.clone());

let mut stream = Box::pin(client.stream_transactions(request));
let persisted = loop {
    let Some(frame) = stream.next().await else {
        return Ok(());
    };
    let frame = frame?;

    if let Some(transaction) = &frame.transaction {
        process_transaction(transaction).await;
    }
    let persisted = frame.cursor.clone();
    persist_position(&persisted).await;
    break persisted;
};
drop(stream);

let restart_request = TransactionStreamRequest::new()
    .with_read_mask(read_mask)
    .with_start(TransactionStreamStart::Resume(persisted));
let mut resumed = Box::pin(client.stream_transactions(restart_request));
let _ = resumed.next().await;

§Timeouts and deadlines

No default bounds the total duration of a call. Two opt-in bounds are available:

  • A per-call deadline set with [tonic::Request::set_timeout]. This attaches the standard grpc-timeout header, so a server that supports it enforces the deadline too, and the client enforces it locally end to end: tonic bounds the wait for response headers, and the client’s watchdog (see with_body_idle_timeout) bounds the response body against the same deadline. The ledger-stream list_* and stream_* methods do not accept tonic::Request. One logical operation may issue several RPCs, so per-RPC authentication, common headers, tracing, and timeouts belong on the client: static headers on Client::with_headers, dynamic per-RPC auth or tracing on Client::request_layer. Configuring a Cloned client affects only that clone and shares the underlying connection, so a single stream gets dedicated headers by receiving a configured clone.
  • A client-wide response-headers timeout set with with_response_headers_timeout. This is enforced locally only and its timer stops once response headers arrive, so it bounds every unary call (whose headers are not sent until the handler completes) without cutting off long-lived streams.

Independent of any deadline, the watchdog resets RPCs whose response body makes no progress for 30 seconds (configurable), so a call on a stalled connection fails with DeadlineExceeded instead of hanging forever.

Implementations§

Source§

impl Client

Source

pub async fn get_delegated_stake( &mut self, staked_sui_id: &Address, ) -> Result<DelegatedStake, Status>

Source

pub async fn list_delegated_stake( &mut self, address: &Address, ) -> Result<Vec<DelegatedStake>, Status>

Source

pub async fn calculate_rewards( &mut self, staked_sui_ids: &[Address], ) -> Result<Vec<(Address, u64)>, Status>

Source

pub async fn get_validator_address_by_pool_id( &mut self, pool_ids: &[Address], ) -> Result<Vec<(Address, Address)>, Status>

Source§

impl Client

Source

pub async fn select_coins( &self, owner_address: &Address, coin_type: &TypeTag, amount: u64, exclude: &[Address], ) -> Result<Vec<Object>, Status>

Selects coins of a specific type owned by an address until the total value meets the required amount.

§Arguments
  • owner_address - The address that owns the coins
  • coin_type - The TypeTag of coins to select
  • amount - The minimum total amount needed
  • exclude - Array of addresses to exclude from selection
§Returns

A vector of Object instances representing the selected coins

§Errors

Returns an error if there are insufficient funds to meet the required amount or if there is an RPC error

Source

pub async fn select_up_to_n_largest_coins( &self, owner_address: &Address, coin_type: &TypeTag, n: usize, exclude: &[Address], ) -> Result<Vec<Object>, Status>

Selects up to N coins of a specific type owned by an address.

§Arguments
  • owner_address - The address that owns the coins
  • coin_type - The TypeTag of coins to select
  • n - The maximum number of coins to select
  • exclude - Array of addresses to exclude from selection
§Returns

A vector of Object instances representing the selected coins (may be fewer than n if not enough coins are available)

§Errors

Returns an error if there is an RPC error during coin retrieval

Source§

impl Client

Source

pub fn list_checkpoints( &self, request: ListCheckpointsRequest, ) -> impl Stream<Item = Result<ListCheckpointsResponse, Status>> + Send + 'static

Paginates ListCheckpoints requests into a stream of raw response pages.

Automatically follows ItemLimit and ScanLimit pagination until reaching the request’s end bound or the ledger tip.

Source

pub fn list_checkpoints_with_config( &self, request: ListCheckpointsRequest, config: ListConfig, ) -> impl Stream<Item = Result<ListCheckpointsResponse, Status>> + Send + 'static

Performs Client::list_checkpoints using config.

Source

pub fn stream_checkpoints( &self, request: CheckpointStreamRequest, ) -> impl Stream<Item = Result<CheckpointStreamFrame, Status>> + Send + 'static

Streams checkpoints indefinitely, automatically retrying transient errors.

The request’s read mask must include sequence_number (or *). To resume after a previous checkpoint, pass cursor + 1 to CheckpointStreamStart::Checkpoint.

For a finite read that stops at a bound, use Client::list_checkpoints.

Source

pub fn stream_checkpoints_with_config( &self, request: CheckpointStreamRequest, config: LedgerStreamConfig, ) -> impl Stream<Item = Result<CheckpointStreamFrame, Status>> + Send + 'static

Performs Client::stream_checkpoints using config.

Source

pub fn list_transactions( &self, request: ListTransactionsRequest, ) -> impl Stream<Item = Result<ListTransactionsResponse, Status>> + Send + 'static

Paginates ListTransactions requests into a stream of raw response pages.

Automatically follows ItemLimit and ScanLimit pagination until reaching the request’s end bound or the ledger tip.

Source

pub fn list_transactions_with_config( &self, request: ListTransactionsRequest, config: ListConfig, ) -> impl Stream<Item = Result<ListTransactionsResponse, Status>> + Send + 'static

Performs Client::list_transactions using config.

Source

pub fn stream_transactions( &self, request: TransactionStreamRequest, ) -> impl Stream<Item = Result<TransactionStreamFrame, Status>> + Send + 'static

Streams transactions indefinitely, automatically retrying transient errors.

The request’s read mask must include checkpoint and transaction_index (or *). To resume from a previous frame, pass frame.cursor to TransactionStreamStart::Resume.

For a finite read that stops at a bound, use Client::list_transactions.

Source

pub fn stream_transactions_with_config( &self, request: TransactionStreamRequest, config: LedgerStreamConfig, ) -> impl Stream<Item = Result<TransactionStreamFrame, Status>> + Send + 'static

Performs Client::stream_transactions using config.

Source

pub fn list_events( &self, request: ListEventsRequest, ) -> impl Stream<Item = Result<ListEventsResponse, Status>> + Send + 'static

Paginates ListEvents requests into a stream of raw response pages.

Automatically follows ItemLimit and ScanLimit pagination until reaching the request’s end bound or the ledger tip.

Source

pub fn list_events_with_config( &self, request: ListEventsRequest, config: ListConfig, ) -> impl Stream<Item = Result<ListEventsResponse, Status>> + Send + 'static

Performs Client::list_events using config.

Source

pub fn stream_events( &self, request: EventStreamRequest, ) -> impl Stream<Item = Result<EventStreamFrame, Status>> + Send + 'static

Streams events indefinitely, automatically retrying transient errors.

The request’s read mask must include checkpoint, transaction_index, and event_index (or *). To resume from a previous frame, pass frame.cursor to EventStreamStart::Resume.

For a finite read that stops at a bound, use Client::list_events.

Source

pub fn stream_events_with_config( &self, request: EventStreamRequest, config: LedgerStreamConfig, ) -> impl Stream<Item = Result<EventStreamFrame, Status>> + Send + 'static

Performs Client::stream_events using config.

Source§

impl Client

Source

pub fn list_owned_objects( &self, request: impl IntoRequest<ListOwnedObjectsRequest>, ) -> impl Stream<Item = Result<Object, Status>> + 'static

Creates a stream of objects based on the provided request.

The stream handles pagination automatically by using the page_token from responses to fetch subsequent pages. The original request’s page_token is used as the starting point.

§Arguments
  • request - The initial ListOwnedObjectsRequest with search criteria
§Returns

A stream that yields Result<Object> instances. If any RPC call fails, the tonic::Status from that request is returned.

Source

pub fn list_dynamic_fields( &self, request: impl IntoRequest<ListDynamicFieldsRequest>, ) -> impl Stream<Item = Result<DynamicField, Status>> + 'static

Creates a stream of DynamicFields based on the provided request.

The stream handles pagination automatically by using the page_token from responses to fetch subsequent pages. The original request’s page_token is used as the starting point.

§Arguments
  • request - The initial ListDynamicFieldsRequest with search criteria
§Returns

A stream that yields Result<DynamicField> instances. If any RPC call fails, the tonic::Status from that request is returned.

Source

pub fn list_balances( &self, request: impl IntoRequest<ListBalancesRequest>, ) -> impl Stream<Item = Result<Balance, Status>> + 'static

Creates a stream of Balances based on the provided request.

The stream handles pagination automatically by using the page_token from responses to fetch subsequent pages. The original request’s page_token is used as the starting point.

§Arguments
  • request - The initial ListBalancesRequest with search criteria
§Returns

A stream that yields Result<Balance> instances. If any RPC call fails, the tonic::Status from that request is returned.

Source

pub fn list_package_versions( &self, request: impl IntoRequest<ListPackageVersionsRequest>, ) -> impl Stream<Item = Result<PackageVersion, Status>> + 'static

Creates a stream of PackageVersions based on the provided request.

The stream handles pagination automatically by using the page_token from responses to fetch subsequent pages. The original request’s page_token is used as the starting point.

§Arguments
  • request - The initial ListPackageVersionsRequest with search criteria
§Returns

A stream that yields Result<PackageVersion> instances. If any RPC call fails, the tonic::Status from that request is returned.

Source§

impl Client

Source

pub async fn execute_transaction_and_wait_for_checkpoint( &mut self, request: impl IntoRequest<ExecuteTransactionRequest>, timeout: Duration, ) -> Result<Response<ExecuteTransactionResponse>, ExecuteAndWaitError>

Executes a transaction and waits for it to be included in a checkpoint.

This method provides “read your writes” consistency by executing the transaction and waiting for it to appear in a checkpoint, which gauruntees indexes have been updated on this node.

§Arguments
  • request - The transaction execution request (ExecuteTransactionRequest)
  • timeout - Maximum time to wait for indexing confirmation
§Returns

A Result containing the response if the transaction was executed and checkpoint confirmed, or an error that may still include the response if execution succeeded but checkpoint confirmation failed.

§Duplicate submissions

Submitting a transaction that has already been executed is handled gracefully. While the execution RPC is in flight the ledger is probed for the transaction, and a transaction that is already in a checkpoint is returned without waiting for execution to finish. Likewise, if execution fails but the ledger shows the transaction in a checkpoint (for example when a resubmission races the original submission), the execution error is discarded and the committed transaction is returned. In both cases the response is assembled from GetTransaction using the request’s read mask, so it carries the same fields an execution response would, with digest, checkpoint, and timestamp always populated.

Source

pub async fn get_reference_gas_price(&mut self) -> Result<u64, Status>

Retrieves the current reference gas price from the latest epoch information.

§Returns

The reference gas price as a u64

§Errors

Returns an error if there is an RPC error when fetching the epoch information

Source§

impl Client

Source

pub const MAINNET_FULLNODE: &str = "https://fullnode.mainnet.sui.io"

URL for the public-good, Sui Foundation provided fullnodes for mainnet.

Source

pub const TESTNET_FULLNODE: &str = "https://fullnode.testnet.sui.io"

URL for the public-good, Sui Foundation provided fullnodes for testnet.

Source

pub const DEVNET_FULLNODE: &str = "https://fullnode.devnet.sui.io"

URL for the public-good, Sui Foundation provided fullnodes for devnet.

Source

pub const MAINNET_ARCHIVE: &str = "https://archive.mainnet.sui.io"

URL for the public-good, Sui Foundation provided archive for mainnet.

Source

pub const TESTNET_ARCHIVE: &str = "https://archive.testnet.sui.io"

URL for the public-good, Sui Foundation provided archive for testnet.

Source

pub fn from_endpoint(endpoint: &Endpoint) -> Self

Build a client from a fully custom [tonic::transport::Endpoint].

This bypasses every transport default that Client::new applies, including the HTTP/2 flow-control windows that protect a connection from starvation by stalled streaming responses. Prefer Client::new plus the with_* configuration methods unless an endpoint setting is needed that the client does not expose. The idle-body watchdog (see Client::with_body_idle_timeout) is part of the client rather than the endpoint and stays enabled.

In particular, do not rely on http2_adaptive_window as a substitute for large static windows: with adaptive windowing, hyper starts the connection window at the 64 KiB HTTP/2 spec default until bandwidth-delay probing ramps up, so a single stalled stream can starve the whole connection.

Source

pub fn new<T>(uri: T) -> Result<Self, Status>
where T: TryInto<Uri>, T::Error: Into<Box<dyn Error + Send + Sync + 'static>>,

Source

pub fn with_body_idle_timeout(self, timeout: Duration) -> Self

Set the idle timeout for the client’s response-body watchdog. Defaults to 30 seconds.

The watchdog bounds the time between response-body progress events: if a whole idle period passes without a frame of the response being delivered to the caller – because the connection is starved or dead, or because the caller has parked a streaming response without polling it – the watchdog resets the stream, releasing the HTTP/2 flow-control window it had pinned, and the call observes a DeadlineExceeded status on its next poll. This is what turns “an RPC on a starved connection hangs forever” into a bounded failure, and what keeps an abandoned stream from starving the shared connection in the first place.

Streams that are legitimately quiet for longer than the timeout (the fullnode’s checkpoint subscription is not: it emits watermarks every few seconds) should raise or disable the watchdog for that call with a BodyIdleTimeout request extension.

Source

pub fn without_body_idle_timeout(self) -> Self

Disable the client’s response-body watchdog (see with_body_idle_timeout).

Without it, an RPC whose response can no longer make progress hangs indefinitely; only disable the watchdog when every call is bounded by the caller. It can be re-enabled for individual requests with a BodyIdleTimeout request extension.

Source

pub fn with_response_headers_timeout(self, timeout: Duration) -> Self

Set a timeout for the response-headers phase of every RPC made through this client. Disabled by default.

The timer covers a request from dispatch on the connection until response headers arrive and is dropped once they do, so a client-wide value does not cut off long-lived streaming responses. Because a server does not send response headers for a unary call until the handler completes, this effectively bounds the total duration of unary calls; the body that follows is bounded by the idle-body watchdog (see with_body_idle_timeout) and, when set, the per-call deadline. Connection establishment is bounded separately by the connect timeout.

This timeout is enforced locally only; it is not communicated to the server. When a per-call deadline ([tonic::Request::set_timeout]) is also set, the shorter of the two bounds the headers phase locally, so a per-call deadline can tighten this bound but never extend it – size the timeout for the slowest expected RPC. Expiry surfaces as DeadlineExceeded.

This rebuilds the underlying channel, so it must be called before the client is used or cloned; earlier clones keep the previous configuration.

Source

pub fn with_num_connections(self, num_connections: usize) -> Self

Set how many HTTP/2 connections the client opens to the endpoint. Defaults to 1; a count of 0 is treated as 1.

Requests are distributed across the connections rather than sharing one connection’s flow-control window and driver task. A single connection’s throughput is bounded by that window and by the one task driving its multiplexed streams, so workloads that keep many streams in flight at once (bulk or streaming reads) can be limited by it well before the server is. Every connection carries the same endpoint configuration, so the window sizes described in with_initial_connection_window_size apply to each one, and the client’s total window budget scales with the count.

Placement is effectively random per request, not a strict rotation, so connections carry equal load only on average. Requests held open concurrently, such as long-lived streams, can land unevenly.

Connections are established lazily and reconnect independently, and one that cannot be established fails only the requests routed to it.

This rebuilds the underlying channel, so it must be called before the client is used or cloned; earlier clones keep the previous configuration.

Source

pub fn with_initial_stream_window_size(self, size: u32) -> Self

Set the HTTP/2 per-stream receive window, in bytes.

This bounds how much unread response data a single RPC can buffer before the server must stop sending on that stream. It also bounds how much of the shared connection window (see with_initial_connection_window_size) one stalled stream can pin. Defaults to 2 MiB.

This rebuilds the underlying channel, so it must be called before the client is used or cloned; earlier clones keep the previous configuration.

Source

pub fn with_initial_connection_window_size(self, size: u32) -> Self

Set the HTTP/2 connection-level receive window, in bytes.

This window is shared by every RPC multiplexed over one of the client’s HTTP/2 connections, including those issued by clones of the client. Response data that the application has not yet read counts against it, so it determines how many concurrently stalled streaming responses it takes to starve a connection and hang every other RPC on it. Defaults to 64 MiB (~32 stalled streams at the default 2 MiB stream window). The window applies per connection, so a client configured with with_num_connections has this much on each.

This rebuilds the underlying channel, so it must be called before the client is used or cloned; earlier clones keep the previous configuration.

Source

pub fn with_headers(self, headers: HeadersInterceptor) -> Self

Source

pub fn request_layer<L, ResBody, E>(self, layer: L) -> Self
where L: Layer<BoxService<Request<Body>, Response<Body>, Box<dyn Error + Send + Sync + 'static>>> + Send + Sync + 'static, L::Service: Service<Request<Body>, Response = Response<ResBody>, Error = E> + Send + 'static, <L::Service as Service<Request<Body>>>::Future: Send + 'static, ResBody: Body<Data = Bytes> + Send + 'static, ResBody::Error: Into<Box<dyn Error + Send + Sync + 'static>>, E: Into<Box<dyn Error + Send + Sync + 'static>> + Send + 'static,

Provide an optional [Layer] that will be used to wrap all RPC requests.

This could be helpful in providing global metrics and logging for all outbound requests.

The layer’s service may return any response body that implements [http_body::Body<Data = bytes::Bytes>] and any error type that implements Into<Box<dyn Error + Send + Sync>>. Both are mapped to the internal types automatically.

§Example

Add a layer that logs each request URI:

use sui_rpc::Client;
use tower::ServiceBuilder;

let client = Client::new(Client::MAINNET_FULLNODE)
    .unwrap()
    .request_layer(ServiceBuilder::new().map_request(|req: http::Request<_>| {
        println!("request to {}", req.uri());
        req
    }));
Source

pub fn with_max_decoding_message_size(self, limit: usize) -> Self

Source

pub fn uri(&self) -> &Uri

Source

pub fn ledger_client( &mut self, ) -> LedgerServiceClient<BoxService<Request<Body>, Response<Body>, Status>>

Source

pub fn state_client( &mut self, ) -> StateServiceClient<BoxService<Request<Body>, Response<Body>, Status>>

Source

pub fn execution_client( &mut self, ) -> TransactionExecutionServiceClient<BoxService<Request<Body>, Response<Body>, Status>>

Source

pub fn package_client( &mut self, ) -> MovePackageServiceClient<BoxService<Request<Body>, Response<Body>, Status>>

Source

pub fn signature_verification_client( &mut self, ) -> SignatureVerificationServiceClient<BoxService<Request<Body>, Response<Body>, Status>>

Source

pub fn subscription_client( &mut self, ) -> SubscriptionServiceClient<BoxService<Request<Body>, Response<Body>, Status>>

Source

pub fn proof_client( &mut self, ) -> ProofServiceClient<BoxService<Request<Body>, Response<Body>, Status>>

Available on crate feature unstable only.

Returns a client for the unstable alpha ProofService, which serves Object Checkpoint State (OCS) inclusion proofs.

Trait Implementations§

Source§

impl Clone for Client

Source§

fn clone(&self) -> Client

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
§

impl<U> As for U

§

fn as_<T>(self) -> T
where T: CastFrom<U>, U: Sized,

Casts self to type T. The semantics of numeric casting with the as operator are followed, so <T as As>::as_::<U> can be used in the same way as T as U for numeric conversions. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
§

impl<T> Conv for T

§

fn conv<T>(self) -> T
where Self: Into<T>,

Converts self into T using Into<T>. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts 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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts 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<T> IntoRequest<T> for T

§

fn into_request(self) -> Request<T>

Wrap the input message T in a tonic::Request
§

impl<L> LayerExt<L> for L

§

fn named_layer<S>(&self, service: S) -> Layered<<L as Layer<S>>::Service, S>
where L: Layer<S>,

Applies the layer to a service and wraps it in [Layered].
§

impl<T> Pipe for T
where T: ?Sized,

§

fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> R
where Self: Sized,

Pipes by value. This is generally the method you want to use. Read more
§

fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> R
where R: 'a,

Borrows 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) -> R
where R: 'a,

Mutably borrows 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
where Self: Borrow<B>, B: 'a + ?Sized, R: 'a,

Borrows self, then passes self.borrow() into the pipe function. Read more
§

fn pipe_borrow_mut<'a, B, R>( &'a mut self, func: impl FnOnce(&'a mut B) -> R, ) -> R
where Self: BorrowMut<B>, B: 'a + ?Sized, R: 'a,

Mutably borrows self, then passes self.borrow_mut() into the pipe function. Read more
§

fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> R
where Self: AsRef<U>, U: 'a + ?Sized, R: 'a,

Borrows 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
where Self: AsMut<U>, U: 'a + ?Sized, R: 'a,

Mutably borrows 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
where Self: Deref<Target = T>, T: 'a + ?Sized, R: 'a,

Borrows self, then passes self.deref() into the pipe function.
§

fn pipe_deref_mut<'a, T, R>( &'a mut self, func: impl FnOnce(&'a mut T) -> R, ) -> R
where Self: DerefMut<Target = T> + Deref, T: 'a + ?Sized, R: 'a,

Mutably borrows self, then passes self.deref_mut() into the pipe function.
§

impl<T> PolicyExt for T
where T: ?Sized,

§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns [Action::Follow] only if self and other return Action::Follow. Read more
§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns [Action::Follow] if either self or other returns Action::Follow. Read more
§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
§

impl<T> Tap for T

§

fn tap(self, func: impl FnOnce(&Self)) -> Self

Immutable access to a value. Read more
§

fn tap_mut(self, func: impl FnOnce(&mut Self)) -> Self

Mutable access to a value. Read more
§

fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Self
where Self: Borrow<B>, B: ?Sized,

Immutable access to the Borrow<B> of a value. Read more
§

fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Self
where Self: BorrowMut<B>, B: ?Sized,

Mutable access to the BorrowMut<B> of a value. Read more
§

fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Self
where Self: AsRef<R>, R: ?Sized,

Immutable access to the AsRef<R> view of a value. Read more
§

fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Self
where Self: AsMut<R>, R: ?Sized,

Mutable access to the AsMut<R> view of a value. Read more
§

fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Self
where Self: Deref<Target = T>, T: ?Sized,

Immutable access to the Deref::Target of a value. Read more
§

fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Self
where Self: DerefMut<Target = T> + Deref, T: ?Sized,

Mutable access to the Deref::Target of a value. Read more
§

fn tap_dbg(self, func: impl FnOnce(&Self)) -> Self

Calls .tap() only in debug builds, and is erased in release builds.
§

fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self

Calls .tap_mut() only in debug builds, and is erased in release builds.
§

fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Self
where Self: Borrow<B>, B: ?Sized,

Calls .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
where Self: BorrowMut<B>, B: ?Sized,

Calls .tap_borrow_mut() only in debug builds, and is erased in release builds.
§

fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Self
where Self: AsRef<R>, R: ?Sized,

Calls .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
where Self: AsMut<R>, R: ?Sized,

Calls .tap_ref_mut() only in debug builds, and is erased in release builds.
§

fn tap_deref_dbg<T>(self, func: impl FnOnce(&T)) -> Self
where Self: Deref<Target = T>, T: ?Sized,

Calls .tap_deref() only in debug builds, and is erased in release builds.
§

fn tap_deref_mut_dbg<T>(self, func: impl FnOnce(&mut T)) -> Self
where Self: DerefMut<Target = T> + Deref, T: ?Sized,

Calls .tap_deref_mut() only in debug builds, and is erased in release builds.
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
§

impl<T> TryConv for T

§

fn try_conv<T>(self) -> Result<T, Self::Error>
where Self: TryInto<T>,

Attempts to convert self into T using TryInto<T>. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

§

fn vzip(self) -> V

§

impl<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more