ContractClient

Struct ContractClient 

Source
pub struct ContractClient<Type> {
    pub client: Client,
    pub address: ContractAddress,
    pub contract_name: Arc<OwnedContractName>,
    pub schema: Arc<Option<VersionedModuleSchema>>,
    /* private fields */
}
Expand description

A contract client that handles some of the boilerplate such as serialization and parsing of responses when sending transactions, or invoking smart contracts.

Note that cloning is cheap and is, therefore, the intended way of sharing values of this type between multiple tasks.

Fields§

§client: Client

The underlying network client.

§address: ContractAddress

The address of the instance.

§contract_name: Arc<OwnedContractName>

The name of the contract at the address.

§schema: Arc<Option<VersionedModuleSchema>>

The schema of the contract at the address.

Implementations§

Source§

impl<Type> ContractClient<Type>

Source

pub async fn create( client: Client, address: ContractAddress, ) -> QueryResult<Self>

Construct a ContractClient by looking up metadata from the chain (such as the contract_name and the embedded schema).

§Arguments
  • client - The RPC client for the concordium node.
  • address - The contract address of the smart contract instance.
Source

pub fn new( client: Client, address: ContractAddress, contract_name: OwnedContractName, ) -> Self

Construct a ContractClient locally. In comparison to create this always succeeds and does not check existence of the contract.

§Arguments
  • client - The RPC client for the concordium node. Note that cloning Client is cheap and is therefore the intended way of sharing.
  • address - The contract address of the smart contract.
  • contract_name - The name of the contract. This must match the name on the chain, otherwise the constructed client will not work.
Source

pub fn new_with_schema( client: Client, address: ContractAddress, contract_name: OwnedContractName, schema: VersionedModuleSchema, ) -> Self

Construct a ContractClient locally. In comparison to create this always succeeds and does not check existence of the contract and does not look up metadata from the chain (such as embedded schemas). In comparison to new this constructor also takes a versioned module schema.

§Arguments
  • client - The RPC client for the concordium node. Note that cloning Client is cheap and is therefore the intended way of sharing.
  • address - The contract address of the smart contract.
  • contract_name - The name of the contract. This must match the name on the chain, otherwise the constructed client will not work.
  • schema - A versioned module schema of the contract. It is used by the client to decode the error codes in rejected transactions.
Source

pub async fn view<P: Serial, A: Deserial, E>( &mut self, entrypoint: &str, parameter: &P, bi: impl IntoBlockIdentifier, ) -> Result<A, E>

Invoke a contract and return the response.

This will always fail for a V0 contract, and for V1 contracts it will attempt to deserialize the response into the provided type A.

The error E is left generic in order to support specialized errors such as CIS2 or CIS4 specific errors for more specialized view functions defined by those standards.

For a general contract ViewError can be used as a concrete error type E.

Source

pub async fn view_raw<A: Deserial, E>( &mut self, entrypoint: &str, parameter: OwnedParameter, bi: impl IntoBlockIdentifier, ) -> Result<A, E>

Like view but expects an already serialized parameter.

Source

pub async fn invoke_raw<E>( &mut self, entrypoint: &str, amount: Amount, invoker: Option<Address>, parameter: OwnedParameter, bi: impl IntoBlockIdentifier, ) -> Result<InvokeContractResult, E>

Invoke a contract instance and return the response without any processing.

Source

pub async fn dry_run_update<P: Serial, E>( &mut self, entrypoint: &str, amount: Amount, sender: AccountAddress, message: &P, ) -> Result<ContractUpdateBuilder, E>

Dry run an update. If the dry run succeeds the return value is an object that has a send method to send the transaction that was simulated during the dry run.

The arguments are

  • entrypoint the name of the entrypoint to be invoked. Note that this is just the entrypoint name without the contract name.
  • amount the amount of CCD to send to the contract instance
  • sender the account that will be sending the transaction
  • message the parameter to the smart contract entrypoint.
Source

pub async fn dry_run_update_with_reject_reason_info<P: Serial, E>( &mut self, entrypoint: &str, amount: Amount, sender: AccountAddress, message: &P, ) -> Result<InvokeContractOutcome, E>

Dry run an update. In comparison to dry_run_update this function does not throw an error when the transaction reverts and instead tries to decode the reject reason into a human-readable error. If the dry run succeeds the return value is an object that has a send method to send the transaction that was simulated during the dry run.

The arguments are

  • entrypoint the name of the entrypoint to be invoked. Note that this is just the entrypoint name without the contract name.
  • amount the amount of CCD to send to the contract instance
  • sender the account that will be sending the transaction
  • message the parameter to the smart contract entrypoint.
Source

pub async fn dry_run_update_raw<E>( &mut self, entrypoint: &str, amount: Amount, sender: AccountAddress, message: OwnedParameter, ) -> Result<ContractUpdateBuilder, E>

Like dry_run_update but expects an already formed parameter.

Source

pub async fn dry_run_update_raw_with_reject_reason_info<E>( &mut self, entrypoint: &str, amount: Amount, sender: AccountAddress, message: OwnedParameter, ) -> Result<InvokeContractOutcome, E>

Like dry_run_update_with_reject_reason_info but expects an already formed parameter.

Source

pub fn make_update<P: Serial, E>( &self, signer: &impl ExactSizeTransactionSigner, metadata: &ContractTransactionMetadata, entrypoint: &str, message: &P, ) -> Result<AccountTransaction<EncodedPayload>, E>

Make the payload of a contract update with the specified parameter.

Source

pub async fn update<P: Serial, E>( &mut self, signer: &impl ExactSizeTransactionSigner, metadata: &ContractTransactionMetadata, entrypoint: &str, message: &P, ) -> Result<TransactionHash, E>

Make and send a transaction with the specified parameter.

Source

pub async fn update_raw<E>( &mut self, signer: &impl ExactSizeTransactionSigner, metadata: &ContractTransactionMetadata, entrypoint: &str, message: OwnedParameter, ) -> Result<TransactionHash, E>

Like update but expects a serialized parameter.

Source

pub fn make_update_raw<E>( &self, signer: &impl ExactSizeTransactionSigner, metadata: &ContractTransactionMetadata, entrypoint: &str, message: OwnedParameter, ) -> Result<AccountTransaction<EncodedPayload>, E>

Like make_update but expects a serialized parameter.

Source§

impl ContractClient<Cis2Type>

Source

pub async fn transfer_dry_run( &mut self, bi: impl IntoBlockIdentifier, sender: Address, transfers: Vec<Transfer>, ) -> Result<Energy, Cis2DryRunError>

Like transfer except it only dry-runs the transaction to get the response and, in case of success, amount of energy used for execution.

§Arguments
  • bi - The block to dry-run at. The invocation happens at the end of the specified block.
  • sender - The address that is invoking the entrypoint.
  • transfers - A list of CIS2 token transfers to execute.
Source

pub async fn transfer_single_dry_run( &mut self, bi: impl IntoBlockIdentifier, sender: Address, transfer: Transfer, ) -> Result<Energy, Cis2DryRunError>

Like transfer_dry_run except it is more ergonomic when only a single transfer is to be made.

Source

pub async fn transfer( &mut self, signer: &impl ExactSizeTransactionSigner, transaction_metadata: Cis2TransactionMetadata, transfers: Vec<Transfer>, ) -> Result<TransactionHash, Cis2TransactionError>

Construct and send a CIS2 transfer smart contract update transaction given a list of CIS2 transfers. Returns a Result with the transaction hash.

§Arguments
  • signer - The account keys to use for signing the smart contract update transaction.
  • transaction_metadata - Metadata for constructing the transaction.
  • transfers - A list of CIS2 token transfers to execute.
Source

pub fn make_transfer( &self, signer: &impl ExactSizeTransactionSigner, transaction_metadata: Cis2TransactionMetadata, transfers: Vec<Transfer>, ) -> Result<AccountTransaction<EncodedPayload>, Cis2TransactionError>

Construct a CIS2 transfer smart contract update transaction given a list of CIS2 transfers. Returns a Result with an account transaction that can be sent.

§Arguments
  • signer - The account keys to use for signing the smart contract update transaction.
  • transaction_metadata - Metadata for constructing the transaction.
  • transfers - A list of CIS2 token transfers to execute.
Source

pub async fn transfer_single( &mut self, signer: &impl ExactSizeTransactionSigner, transaction_metadata: Cis2TransactionMetadata, transfer: Transfer, ) -> Result<TransactionHash, Cis2TransactionError>

Like transfer, except it is more ergonomic when transferring a single token.

Source

pub fn make_transfer_single( &self, signer: &impl ExactSizeTransactionSigner, transaction_metadata: Cis2TransactionMetadata, transfer: Transfer, ) -> Result<AccountTransaction<EncodedPayload>, Cis2TransactionError>

Like make_transfer, except it is more ergonomic when transferring a single token.

Source

pub async fn update_operator_dry_run( &mut self, bi: impl IntoBlockIdentifier, owner: Address, updates: Vec<UpdateOperator>, ) -> Result<Energy, Cis2DryRunError>

Dry run a CIS2 updateOperator transaction. This is analogous to update_operator, except that it does not send a transaction to the chain, and just simulates the transaction.

§Arguments
  • bi - The block to dry-run at. The invocation happens at the end of
  • owner - The address that is invoking. This is the owner of the tokens.
  • updates - A list of CIS2 UpdateOperators to update.
Source

pub async fn update_operator_single_dry_run( &mut self, bi: impl IntoBlockIdentifier, owner: Address, operator: Address, update: OperatorUpdate, ) -> Result<Energy, Cis2DryRunError>

Like update_operator_dry_run except more ergonomic when a single operator is to be updated.

Source

pub fn make_update_operator( &self, signer: &impl ExactSizeTransactionSigner, transaction_metadata: Cis2TransactionMetadata, updates: Vec<UpdateOperator>, ) -> Result<AccountTransaction<EncodedPayload>, Cis2TransactionError>

Construct a CIS2 updateOperator smart contract update transaction given a list of CIS2 UpdateOperators. Returns a Result with the account transaction that can be sent.

§Arguments
  • signer - The account keys to use for signing the smart contract update transaction.
  • transaction_metadata - Metadata for constructing the transaction.
  • updates - A list of CIS2 UpdateOperators to update.
Source

pub async fn update_operator( &mut self, signer: &impl ExactSizeTransactionSigner, transaction_metadata: Cis2TransactionMetadata, updates: Vec<UpdateOperator>, ) -> Result<TransactionHash, Cis2TransactionError>

Construct and send a CIS2 updateOperator smart contract update transaction given a list of CIS2 UpdateOperators. Returns a Result with the transaction hash.

§Arguments
  • signer - The account keys to use for signing the smart contract update transaction.
  • transaction_metadata - Metadata for constructing the transaction.
  • updates - A list of CIS2 UpdateOperators to update.
Source

pub async fn update_operator_single( &mut self, signer: &impl ExactSizeTransactionSigner, transaction_metadata: Cis2TransactionMetadata, operator: Address, update: OperatorUpdate, ) -> Result<TransactionHash, Cis2TransactionError>

Like update_operator, but more ergonomic when updating a single operator.

Source

pub fn make_update_operator_single( &self, signer: &impl ExactSizeTransactionSigner, transaction_metadata: Cis2TransactionMetadata, operator: Address, update: OperatorUpdate, ) -> Result<AccountTransaction<EncodedPayload>, Cis2TransactionError>

Like make_update_operator, but more ergonomic when updating a single operator.

Source

pub async fn balance_of( &mut self, bi: impl IntoBlockIdentifier, queries: Vec<BalanceOfQuery>, ) -> Result<BalanceOfQueryResponse, Cis2QueryError>

Invoke the CIS2 balanceOf query given a list of BalanceOfQuery.

Note: the query is executed locally by the node and does not produce a transaction on-chain.

§Arguments
  • bi - The block to query. The query will be executed in the state of the chain at the end of the block.
  • queries - A list queries to execute.
Source

pub async fn balance_of_single( &mut self, bi: impl IntoBlockIdentifier, token_id: TokenId, address: Address, ) -> Result<TokenAmount, Cis2QueryError>

Like balance_of, except for querying a single token. This additionally ensures that the response has correct length.

Source

pub async fn operator_of( &mut self, bi: impl IntoBlockIdentifier, queries: Vec<OperatorOfQuery>, ) -> Result<OperatorOfQueryResponse, Cis2QueryError>

Invoke the CIS2 operatorOf query given a list of OperatorOfQuery.

Note: the query is executed locally by the node and does not produce a transaction on-chain.

§Arguments
  • bi - The block to query. The query will be executed in the state of the chain at the end of the block.
  • queries - A list queries to execute.
Source

pub async fn operator_of_single( &mut self, bi: impl IntoBlockIdentifier, owner: Address, operator: Address, ) -> Result<bool, Cis2QueryError>

Like operator_of, except for querying a single owner-address pair. This additionally ensures that the response has correct length.

Source

pub async fn token_metadata( &mut self, bi: impl IntoBlockIdentifier, queries: Vec<TokenId>, ) -> Result<TokenMetadataQueryResponse, Cis2QueryError>

Invoke the CIS2 tokenMetadata query given a list of CIS2 TokenIds.

Note: the query is executed locally by the node and does not produce a transaction on-chain.

§Arguments
  • bi - The block to query. The query will be executed in the state of the chain at the end of the block.
  • queries - A list queries to execute.
Source

pub async fn token_metadata_single( &mut self, bi: impl IntoBlockIdentifier, token_id: TokenId, ) -> Result<MetadataUrl, Cis2QueryError>

Like token_metadata, except for querying a single token. This additionally ensures that the response has correct length.

Source§

impl ContractClient<Cis3Type>

Source

pub async fn permit_dry_run( &mut self, bi: impl IntoBlockIdentifier, sender: Address, params: PermitParams, ) -> Result<Energy, Cis3PermitDryRunError>

Like permit except it only dry-runs the transaction to get the response and, in case of success, amount of energy used for execution.

§Arguments
  • bi - The block to query. The query will be executed in the state of the chain at the end of the block.
  • sender - The (sponsor) address that is invoking the entrypoint.
  • params - The parameters for the permit invocation. Includes the signature of the sponsoree, the address of the sponsoree, and the signed message.
Source

pub async fn permit( &mut self, signer: &impl ExactSizeTransactionSigner, metadata: &ContractTransactionMetadata, params: PermitParams, ) -> Result<TransactionHash, Cis3PermitError>

Construct and send a CIS3 sponsored transaction. This function takes a signature from the sponsoree along with their account address, and the signed message to be executed by the contract. Returns a Result with the transaction hash.

§Arguments
  • signer - The account keys (of the sponsor) to use for signing the smart contract update transaction.
  • metadata - Metadata for constructing the transaction.
  • params - The parameters for the permit invocation. Includes the signature of the sponsoree, the address of the sponsoree, and the signed message.
Source

pub fn make_permit( &mut self, signer: &impl ExactSizeTransactionSigner, metadata: &ContractTransactionMetadata, params: PermitParams, ) -> Result<AccountTransaction<EncodedPayload>, Cis3PermitError>

Construct a CIS3 sponsored transaction. This function takes a signature from the sponsoree along with their account address, and the signed message to be executed by the contract. Returns a Result with the transaction hash.

§Arguments
  • signer - The account keys (of the sponsor) to use for signing the smart contract update transaction.
  • metadata - Metadata for constructing the transaction.
  • params - The parameters for the permit invocation. Includes the signature of the sponsoree, the address of the sponsoree, and the signed message.
Source

pub async fn supports_permit( &mut self, bi: impl IntoBlockIdentifier, entrypoints: Vec<OwnedEntrypointName>, ) -> Result<SupportsPermitRepsonse, Cis3SupportsPermitError>

Invoke the CIS3 supportsPermit query given a list of entrypoints to query.

Note: the query is executed locally by the node and does not produce a transaction on-chain.

§Arguments
  • bi - The block to query. The query will be executed in the state of the chain at the end of the block.
  • entrypoints - A list queries to execute.
Source

pub async fn supports_permit_single( &mut self, bi: impl IntoBlockIdentifier, entrypoint: OwnedEntrypointName, ) -> Result<bool, Cis3SupportsPermitError>

Like supports_permit, but only queries a single entrypoint, and returns a bool indicating whether the entrypoint is supported.

Source§

impl ContractClient<Cis4Type>

Source

pub async fn credential_entry( &mut self, cred_id: CredentialHolderId, bi: impl IntoBlockIdentifier, ) -> Result<CredentialEntry, Cis4QueryError>

Look up an entry in the registry by its id.

Source

pub async fn credential_status( &mut self, cred_id: CredentialHolderId, bi: impl IntoBlockIdentifier, ) -> Result<CredentialStatus, Cis4QueryError>

Look up the status of a credential by its id.

Source

pub async fn revocation_keys( &mut self, bi: impl IntoBlockIdentifier, ) -> Result<Vec<RevocationKeyWithNonce>, Cis4QueryError>

Get the list of all the revocation keys together with their nonces.

Source

pub async fn registry_metadata( &mut self, bi: impl IntoBlockIdentifier, ) -> Result<RegistryMetadata, Cis4QueryError>

Look up the credential registry’s metadata.

Source

pub async fn issuer( &mut self, bi: impl IntoBlockIdentifier, ) -> Result<IssuerKey, Cis4QueryError>

Look up the issuer’s public key.

Source

pub fn make_register_credential( &self, signer: &impl ExactSizeTransactionSigner, metadata: &Cis4TransactionMetadata, cred_info: &CredentialInfo, additional_data: &[u8], ) -> Result<AccountTransaction<EncodedPayload>, Cis4TransactionError>

Construct a transaction for registering a new credential. Note that this does not send the transaction.c

Source

pub async fn register_credential( &mut self, signer: &impl ExactSizeTransactionSigner, metadata: &Cis4TransactionMetadata, cred_info: &CredentialInfo, additional_data: &[u8], ) -> Result<TransactionHash, Cis4TransactionError>

Register a new credential.

Source

pub fn make_revoke_credential_as_issuer( &self, signer: &impl ExactSizeTransactionSigner, metadata: &Cis4TransactionMetadata, cred_id: CredentialHolderId, reason: Option<Reason>, ) -> Result<AccountTransaction<EncodedPayload>, Cis4TransactionError>

Construct a transaction to revoke a credential as an issuer.

Source

pub async fn revoke_credential_as_issuer( &mut self, signer: &impl ExactSizeTransactionSigner, metadata: &Cis4TransactionMetadata, cred_id: CredentialHolderId, reason: Option<Reason>, ) -> Result<TransactionHash, Cis4TransactionError>

Revoke a credential as an issuer.

Source

pub async fn revoke_credential_as_holder( &mut self, signer: &impl ExactSizeTransactionSigner, metadata: &Cis4TransactionMetadata, web3signer: impl Web3IdSigner, nonce: u64, reason: Option<Reason>, ) -> Result<TransactionHash, Cis4TransactionError>

Revoke a credential as the holder.

The extra nonce that must be provided is the holder’s nonce inside the contract. The signature on this revocation message is set to expire at the same time as the transaction.

Source

pub fn make_revoke_credential_as_holder( &self, signer: &impl ExactSizeTransactionSigner, metadata: &Cis4TransactionMetadata, web3signer: impl Web3IdSigner, nonce: u64, reason: Option<Reason>, ) -> Result<AccountTransaction<EncodedPayload>, Cis4TransactionError>

Revoke a credential as the holder.

The extra nonce that must be provided is the holder’s nonce inside the contract. The signature on this revocation message is set to expire at the same time as the transaction.

Source

pub async fn revoke_credential_other( &mut self, signer: &impl ExactSizeTransactionSigner, metadata: &Cis4TransactionMetadata, revoker: impl Web3IdSigner, nonce: u64, cred_id: CredentialHolderId, reason: Option<&Reason>, ) -> Result<TransactionHash, Cis4TransactionError>

Revoke a credential as another party, distinct from issuer or holder.

The extra nonce that must be provided is the nonce associated with the key that signs the revocation message. The signature on this revocation message is set to expire at the same time as the transaction.

Source

pub fn make_revoke_credential_other( &self, signer: &impl ExactSizeTransactionSigner, metadata: &Cis4TransactionMetadata, revoker: impl Web3IdSigner, nonce: u64, cred_id: CredentialHolderId, reason: Option<&Reason>, ) -> Result<AccountTransaction<EncodedPayload>, Cis4TransactionError>

Construct a transaction to revoke a credential as another party, distinct from issuer or holder.

The extra nonce that must be provided is the nonce associated with the key that signs the revocation message. The signature on this revocation message is set to expire at the same time as the transaction.

Trait Implementations§

Source§

impl<Type> Clone for ContractClient<Type>

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 · Source§

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

Performs copy-assignment from source. Read more
Source§

impl<Type: Debug> Debug for ContractClient<Type>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl<Type> !Freeze for ContractClient<Type>

§

impl<Type> !RefUnwindSafe for ContractClient<Type>

§

impl<Type> Send for ContractClient<Type>
where Type: Send,

§

impl<Type> Sync for ContractClient<Type>
where Type: Sync,

§

impl<Type> Unpin for ContractClient<Type>
where Type: Unpin,

§

impl<Type> !UnwindSafe for ContractClient<Type>

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

impl<T> Conv for T

Source§

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

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

impl<T> FmtForward for T

Source§

fn fmt_binary(self) -> FmtBinary<Self>
where Self: Binary,

Causes self to use its Binary implementation when Debug-formatted.
Source§

fn fmt_display(self) -> FmtDisplay<Self>
where Self: Display,

Causes self to use its Display implementation when Debug-formatted.
Source§

fn fmt_lower_exp(self) -> FmtLowerExp<Self>
where Self: LowerExp,

Causes self to use its LowerExp implementation when Debug-formatted.
Source§

fn fmt_lower_hex(self) -> FmtLowerHex<Self>
where Self: LowerHex,

Causes self to use its LowerHex implementation when Debug-formatted.
Source§

fn fmt_octal(self) -> FmtOctal<Self>
where Self: Octal,

Causes self to use its Octal implementation when Debug-formatted.
Source§

fn fmt_pointer(self) -> FmtPointer<Self>
where Self: Pointer,

Causes self to use its Pointer implementation when Debug-formatted.
Source§

fn fmt_upper_exp(self) -> FmtUpperExp<Self>
where Self: UpperExp,

Causes self to use its UpperExp implementation when Debug-formatted.
Source§

fn fmt_upper_hex(self) -> FmtUpperHex<Self>
where Self: UpperHex,

Causes self to use its UpperHex implementation when Debug-formatted.
Source§

fn fmt_list(self) -> FmtList<Self>
where &'a Self: for<'a> IntoIterator,

Formats each item in a sequence. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

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

Source§

fn from_ref(input: &T) -> T

Converts to this type from a reference to the input type.
Source§

impl<T> Instrument for T

Source§

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

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

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

impl<T> IntoRequest<T> for T

Source§

fn into_request(self) -> Request<T>

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

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

Source§

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

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

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

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

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

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.
Source§

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.
Source§

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.
Source§

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.
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> Tap for T

Source§

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

Immutable access to a value. Read more
Source§

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

Mutable access to a value. Read more
Source§

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

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

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

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

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

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

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

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

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

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

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.
Source§

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.
Source§

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.
Source§

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.
Source§

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.
Source§

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

impl<T> TryConv for T

Source§

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.
Source§

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

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

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

fn with_current_subscriber(self) -> WithDispatch<Self>

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