Struct Sdk

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

Struct representing the SDK and its core components including configuration, user management, and storage options.

Implementations§

Source§

impl Sdk

Source

pub fn set_config(&mut self, config: Config) -> Result<()>

Set the Config needed by the SDK

Source§

impl Sdk

Source

pub async fn start_kyc_verification_for_postident( &mut self, ) -> Result<NewCaseIdResponse>

Start kyc verification for postident

§Returns

Returns a Result containing the NewCaseIdResponse if successful, or a crate::Error if an error occurs.

§Errors
Source

pub async fn get_kyc_details_for_postident(&self) -> Result<CaseDetailsResponse>

Get case details for postident

§Returns

Returns a Result containing the CaseDetailsResponse if successful, or a crate::Error if an error occurs.

§Errors
  • [crate::Error::UserNotInitialized)] if the user fails to initialize.
Source

pub async fn update_kyc_status_for_postident(&self, case_id: &str) -> Result<()>

Update case status for postident

§Arguments
  • case_id: The ID of the case to update.
§Errors

Returns a Result containing () if successful, or a crate::Error if an error occurs.

§Returns

Returns Ok(()) if the case status is updated successfully.

Source§

impl Sdk

Source

pub async fn create_purchase_request( &self, receiver: &str, amount: CryptoAmount, product_hash: &str, app_data: &str, purchase_type: &str, ) -> Result<String>

Create purchase request

§Arguments
  • receiver - The receiver’s username.
  • amount - The amount of the purchase.
  • product_hash - The hash of the product.
  • app_data - The application data.
  • purchase_type - The type of the purchase.
§Returns

The purchase ID. This is an internal index used to reference the transaction in etopay

§Errors

Returns an error if the user or wallet is not initialized, or if there is an error creating the transaction.

Source

pub async fn get_purchase_details( &self, purchase_id: &str, ) -> Result<PurchaseDetails>

Get purchase details

§Arguments
  • purchase_id - The ID of the purchase.
§Returns

The purchase details.

§Errors

Returns an error if the user or wallet is not initialized, or if there is an error getting the transaction details.

Source

pub async fn confirm_purchase_request( &mut self, pin: &EncryptionPin, purchase_id: &str, ) -> Result<()>

Confirm purchase request

§Arguments
  • pin - The PIN of the user.
  • purchase_id - The ID of the purchase request.
§Returns

Returns Ok(()) if the purchase request is confirmed successfully.

§Errors

Returns an error if the user or wallet is not initialized, if there is an error verifying the PIN, if there is an error getting the transaction details, or if there is an error committing the transaction.

Source

pub async fn send_amount( &mut self, pin: &EncryptionPin, address: &str, amount: CryptoAmount, data: Option<Vec<u8>>, ) -> Result<String>

Send amount to receiver address

§Arguments
  • pin - The PIN of the user.
  • address - The receiver’s address.
  • amount - The amount to send.
  • data - The associated data with the tag. Optional.
§Returns

Returns Ok(String) containing the transaction hash if the amount is sent successfully.

§Errors

Returns an error if the user or wallet is not initialized, if there is an error verifying the PIN, or if there is an error sending the amount.

Source

pub async fn estimate_gas( &mut self, pin: &EncryptionPin, address: &str, amount: CryptoAmount, data: Option<Vec<u8>>, ) -> Result<GasCostEstimation>

Estimate gas for sending amount to receiver

§Arguments
  • pin - The PIN of the user.
  • address - The receiver’s address.
  • amount - The amount to send.
  • data - The associated data with the tag. Optional.
§Returns

Returns the gas estimation.

§Errors

Returns an error if the user or wallet is not initialized, if there is an error verifying the PIN, or if there is an error estimating the gas.

Source

pub async fn get_tx_list(&self, start: u32, limit: u32) -> Result<TxList>

Get transaction list

§Arguments
  • start - The starting page number.
  • limit - The maximum number of transactions per page.
§Returns

Returns a Result containing a TxList if successful.

§Errors

Returns an error if there is a problem getting the list of transactions.

Source§

impl Sdk

Source

pub async fn get_user(&self) -> Result<UserEntity>

Get user entity

§Returns

Returns a Result containing the user entity (UserEntity) if successful, or an Error if an error occurs.

§Errors

Returns an Error if there is an issue initializing the user or accessing the repository.

Source

pub async fn create_new_user(&mut self, username: &str) -> Result<()>

Create a new user

§Arguments
  • username - The username of the new user.
§Returns

Returns Ok(()) if the user is created successfully, or an Error if an error occurs.

§Errors

Returns an Error if there is an issue validating the configuration, initializing the repository, or creating the user.

Source

pub async fn delete_user(&mut self, pin: Option<&EncryptionPin>) -> Result<()>

Delete the currently active user and their wallet

§Arguments
  • pin - The PIN of the user to be deleted.
§Returns

Returns Ok(()) if the user is deleted successfully, or an Error if an error occurs.

§Errors

Returns an Error if there is an issue verifying the PIN, initializing the repository, initiliazing the user, deleting the user, or deleting the wallet.

Source

pub async fn init_user(&mut self, username: &str) -> Result<()>

Initialize an user

§Arguments
  • username - The username of the user to initialize.
§Returns

Returns Ok(()) if the user is initialized successfully, or an Error if an error occurs.

§Errors

Returns an Error if there is an issue validating the configuration, initializing the repository, or checking the KYC status.

Source

pub async fn refresh_access_token( &mut self, access_token: Option<AccessToken>, ) -> Result<()>

Refresh access token

§Arguments
  • access_token - The new access token to be set. Or None to unset it.
§Returns

Returns Ok(()) if the access token is refreshed successfully, or an Error if an error occurs.

§Errors

Returns an Error if there is an issue validating the configuration.

Source

pub async fn is_kyc_status_verified(&mut self, username: &str) -> Result<bool>

Check if KYC status is verified.

§Arguments
  • username - The username of the user to check KYC status for.
§Returns

Returns Ok(true) if the KYC status is verified, or Ok(false) if it is not verified.

§Errors

Returns an Error if there is an issue validating the configuration, initializing the repository, or checking the KYC status.

Source

pub async fn set_preferred_network( &mut self, network_key: Option<String>, ) -> Result<()>

Set the user preferred network

Source

pub async fn get_preferred_network(&self) -> Result<Option<String>>

Get the user preferred network

Source§

impl Sdk

Source

pub async fn get_iban_for_viviswap(&mut self) -> Result<ViviswapAddressDetail>

Get current iban of viviswap user

§Arguments

None

§Returns
  • Result<ViviswapAddressDetail> - The current IBAN of the viviswap user.
§Errors
  • [crate::Error::ViviswapInvalidState] - If the viviswap state is invalid.
  • crate::Error::UserRepoNotInitialized - If the repository initialization fails.
  • [crate::Error::ViviswapApi] - If there is an error in the viviswap API.
  • [crate::Error::UserStatusUpdateError] - If there is an error updating the user status.
Source

pub async fn update_iban_for_viviswap( &mut self, pin: &EncryptionPin, address: String, ) -> Result<ViviswapAddressDetail>

Update IBAN of viviswap user.

§Arguments
  • pin - The user’s PIN.
  • address - The new IBAN address.
§Returns
  • Result<ViviswapAddressDetail> - The updated Viviswap address detail.
§Errors
  • crate::Error::UserRepoNotInitialized - If the repository initialization fails.
  • [crate::Error::ViviswapMissingUserError] - If the viviswap user is missing.
  • [crate::Error::UserStatusUpdateError] - If there is an error updating the user status.
Source

pub async fn create_deposit_with_viviswap( &mut self, pin: &EncryptionPin, ) -> Result<ViviswapDeposit>

create deposit for viviswap user

§Returns
  • Result<ViviswapDeposit> - The created Viviswap deposit.
§Errors
  • crate::Error::UserRepoNotInitialized - If the repository initialization fails.
  • [crate::Error::ViviswapMissingUserError] - If the viviswap user is missing.
  • [crate::Error::ViviswapInvalidState] - If the viviswap state is invalid.
  • [crate::Error::ViviswapApi] - If there is an error with the Viviswap API.
Source

pub async fn create_detail_for_viviswap( &mut self, pin: &EncryptionPin, ) -> Result<ViviswapAddressDetail>

create detail for viviswap user

§Returns
  • Result<ViviswapAddressDetail> - The created Viviswap address detail.
§Errors
  • [crate::Error::ConfigInitError] - If there is an error initializing the configuration.
  • [crate::Error::ViviswapMissingUserError] - If the viviswap user is missing.
Source

pub async fn create_withdrawal_with_viviswap( &mut self, amount: CryptoAmount, pin: Option<&EncryptionPin>, data: Option<Vec<u8>>, ) -> Result<ViviswapWithdrawal>

create withdrawal for viviswap user

§Arguments
  • amount - The amount of the withdrawal.
  • pin - The optional PIN for verification.
  • tag - The transactions tag. Optional.
  • data - The associated data with the tag. Optional.
  • message - The transactions message. Optional.
§Returns
  • Result<ViviswapWithdrawal> - The created Viviswap withdrawal.
§Errors
  • [crate::Error::ViviswapMissingUserError] - If the viviswap user is missing.
  • [crate::Error::ViviswapInvalidState] - If the viviswap state is invalid.
  • [crate::Error::ViviswapApi] - If there is an error with the Viviswap API.
Source

pub async fn get_swap_list(&self, start: u32, limit: u32) -> Result<OrderList>

Get the list of swaps for the viviswap user.

§Returns

Returns a Result containing a vector of Swap if successful, or a crate::Error if an error occurs.

§Errors

Returns an Err variant of crate::Error if any of the following conditions are met:

  • Repository initialization error.
  • Viviswap API error.
Source

pub async fn get_swap_details(&self, order_id: String) -> Result<Order>

Get swap details

§Arguments
  • order_id - The ID of the swap order.
§Returns

Returns a Result containing the swap order details or an error.

Source§

impl Sdk

Source

pub async fn start_kyc_verification_for_viviswap( &mut self, mail: &str, terms_accepted: bool, ) -> Result<NewViviswapUser>

Create new viviswap user and initialize kyc verification

§Arguments
  • mail - The email address of the user.
  • terms_accepted - A boolean indicating whether the terms have been accepted.
§Returns

Returns a Result containing a NewViviswapUser if successful, or a crate::Error if an error occurs.

§Errors

Returns an Err variant of crate::Error if any of the following conditions are met:

  • Repository initialization error.
  • User already exists.
  • Viviswap API error.
  • User status update error.
Source

pub async fn get_kyc_details_for_viviswap( &mut self, ) -> Result<ViviswapKycStatus>

Get current kyc status of viviswap

§Returns

Returns a Result containing a ViviswapKycStatus if successful, or a crate::Error if an error occurs.

§Errors

Returns an Err variant of crate::Error if any of the following conditions are met:

  • Repository initialization error.
  • Viviswap API error.
Source

pub async fn submit_kyc_partially_status_for_viviswap(&mut self) -> Result<()>

Submit the previously entered partial kyc details for viviswap.

§Errors

Returns a vector of crate::Error if any of the following conditions are met:

  • Repository initialization error.
  • Viviswap missing user error.
  • Viviswap invalid state error.
  • Viviswap missing field error.
  • Viviswap API error.
§Returns

Returns Ok(()) if the submission is successful.

Source

pub async fn update_kyc_partially_status_for_viviswap( &mut self, is_individual: Option<bool>, is_pep: Option<bool>, is_us_citizen: Option<bool>, is_regulatory_disclosure: Option<bool>, country_of_residence: Option<String>, nationality: Option<String>, full_name: Option<String>, date_of_birth: Option<String>, ) -> Result<ViviswapPartiallyKycDetails>

Update the kyc details for viviswap to be submitted

§Arguments
  • is_individual - Whether the user is an individual.
  • is_pep - Whether the user is a politically exposed person.
  • is_us_citizen - Whether the user is a US citizen.
  • is_regulatory_disclosure - Whether the user has accepted the regulatory disclosure.
  • country_of_residence - The country of residence of the user.
  • nationality - The nationality of the user.
  • full_name - The full name of the user.
  • date_of_birth - The date of birth of the user.
§Returns

Returns a Result containing the partially updated KYC details or a vector of errors.

§Errors

Returns a vector of errors if any validation errors occur during the update process.

Source

pub async fn set_viviswap_kyc_identity_details( &self, official_document: IdentityOfficialDocumentData, personal_document: IdentityPersonalDocumentData, ) -> Result<()>

Set KYC identity details

§Arguments
  • official_document - The official document that verifies the person (eg. ID-Card, Passport, Drivers License …).
  • personal_document - A 30 second video document that verifies that this person is willing to verify at viviswap and that the person really is the one they claim to be.
§Errors
  • [[crate::Error::UserNotInitialized)]] - If the user is not initialized.
  • [[crate::Error::ViviswapApiError]] - If there is an error in the viviswap API.
Source

pub async fn set_viviswap_kyc_residence_details( &self, country_code: String, region: String, zip_code: String, city: String, address_line_1: String, address_line_2: String, is_public_entry: bool, public_entry_reference: Option<String>, has_no_official_document: bool, document_residence_proof: Option<File>, ) -> Result<()>

Set KYC residence details

§Arguments
  • country_code, region, zip_code, city, address_line_1, address_line_2 - basic address data.
  • is_public_entry - Inidcates that a valid public entry of this clients address can be found.
  • public_entry_reference - if is_public_entry is true, then this must contain the resource link.
  • has_no_official_document - indicates if the client does not have any document verifying their address.
  • document_residence_proof - if has_no_official_document is false, then this must contain the document file that verifies that this person is currently living at the address submitted.
§Errors
  • [[crate::Error::UserNotInitialized)]] - If the user is not initialized.
  • [[crate::Error::ViviswapValidation]] - If the input values are not valid.
  • [[crate::Error::ViviswapApiError]] - If there is an error in the viviswap API.
Source

pub async fn get_viviswap_kyc_amla_open_questions( &self, ) -> Result<Vec<KycAmlaQuestion>>

Get the open AMLA KYC questions

§Arguments

None

§Returns
  • A list of the currently open AMLA questions.
§Errors
  • [[crate::Error::UserNotInitialized)]] - If the user is not initialized.
  • [[crate::Error::ViviswapApiError]] - If there is an error in the viviswap API.
Source

pub async fn set_viviswap_kyc_amla_answer( &self, question_id: String, answers: Vec<String>, freetext_answer: Option<String>, ) -> Result<()>

Set the answer to an open AMLA KYC question

§Arguments
  • question_id - The ID of the question to set the answer to.
  • answers - a list of the selected available answers for the question.
  • freetext_answer - an optional free-text answer.
§Errors
  • [[crate::Error::UserNotInitialized)]] - If the user is not initialized.
  • [[crate::Error::ViviswapApiError]] - If there is an error in the viviswap API.
Source

pub async fn get_viviswap_kyc_open_documents( &self, ) -> Result<Vec<KycOpenDocument>>

Get the currently open/missing documents for KYC

§Arguments

None

§Returns
  • A list of the currently open documents.
§Errors
  • [crate::Error::UserNotInitialized)] - If the user is not initialized.
  • [crate::Error::ViviswapApiError] - If there is an error in the viviswap API.
Source

pub async fn set_viviswap_kyc_document( &self, document_id: String, expiration_date: String, document_number: String, front_image: Option<File>, back_image: Option<File>, ) -> Result<()>

Set / upload an open KYC document

§Arguments
  • document_id - The ID of the document to upload.
  • expiration_date - the expiration date of this document.
  • document_number - the official document number.
  • front_image - the front image of the official document.
  • back_image - the back image of the official document.
§Errors
  • [crate::Error::ViviswapApiError] - If there is an error in the viviswap API.
  • [crate::Error::UserNotInitialized)] - If the user is not initialized.
Source§

impl Sdk

Source

pub async fn create_wallet_from_new_mnemonic( &mut self, pin: &EncryptionPin, ) -> Result<String>

Create and store a wallet from a new random mnemonic

§Arguments
  • pin - The PIN for the wallet.
§Returns

The new random mnemonic.

§Errors
Source

pub async fn create_wallet_from_existing_mnemonic( &mut self, pin: &EncryptionPin, mnemonic: &str, ) -> Result<()>

Create and store a wallet from an existing mnemonic

§Arguments
  • pin - The PIN for the wallet.
  • mnemonic - The mnemonic to use for the wallet.
§Errors
Source

pub async fn create_wallet_from_backup( &mut self, pin: &EncryptionPin, backup: &[u8], backup_password: &PlainPassword, ) -> Result<()>

Create and store a wallet from an existing kdbx backup file

§Arguments
  • pin - The PIN for the wallet.
  • backup - The bytes representing the backup file.
  • backup_password - The password used when creating the backup file.
§Errors
Source

pub async fn create_wallet_backup( &mut self, pin: &EncryptionPin, backup_password: &PlainPassword, ) -> Result<Vec<u8>>

Create a kdbx wallet backup from an existing wallet.

§Arguments
  • pin - The PIN for the wallet.
  • backup_password - The password to use when creating the backup file.
§Returns

The bytes of the kdbx backup file.

§Errors
Source

pub async fn verify_mnemonic( &mut self, pin: &EncryptionPin, mnemonic: &str, ) -> Result<bool>

Verify the mnemonic by checking if the mnemonic is the same as the one in the shares

§Arguments
  • pin - The PIN for the wallet.
  • mnemonic - The mnemonic to verify.
§Returns

Returns Ok(true) if the mnemonic is successfully verified, otherwise returns Ok(false), or an Error.

§Errors
Source

pub async fn delete_wallet(&mut self, pin: &EncryptionPin) -> Result<()>

Delete the currently active wallet

Deletes the currently active wallet, potentially resulting in loss of funds if the mnemonic or wallet is not backed up.

§Returns

Returns Ok(()) if the wallet is successfully deleted, otherwise returns an Error.

§Errors
Source

pub async fn verify_pin(&self, pin: &EncryptionPin) -> Result<()>

Verify pin

Verifies the pin for the wallet.

§Arguments
  • pin - The pin to verify.
§Returns

Returns Ok(()) if the pin is verified successfully, otherwise returns an Error.

§Errors
Source

pub async fn change_pin( &mut self, old_pin: &EncryptionPin, new_pin: &EncryptionPin, ) -> Result<()>

Reset pin

Resets the pin for the wallet using the provided password and new pin.

§Arguments
  • old_pin - The old wallet pin.
  • new_pin - The new pin to set for the wallet.
§Returns

Returns Ok(()) if the pin is changed successfully, otherwise returns an Error.

§Errors
Source

pub async fn set_wallet_password( &mut self, pin: &EncryptionPin, new_password: &PlainPassword, ) -> Result<()>

Set the password to use for wallet operations. If the password was already set, this changes it.

§Arguments
  • pin - The pin to encrypt the password with.
  • new_password - The new password to set for the wallet.
§Returns

Returns Ok(()) if the password is set successfully, otherwise returns an Error.

§Errors
Source

pub async fn is_wallet_password_set(&self) -> Result<bool>

Check if the password to use for wallet operations is set. If this returns false, the password should be set with [set_wallet_password], otherwise you need to use [change_password] to change it.

§Returns

Returns Ok(true) if the password is set successfully, otherwise returns Ok(false).

§Errors
Source

pub async fn generate_new_address( &mut self, pin: &EncryptionPin, ) -> Result<String>

Generates a new receiver address (based on selected currency in the config) for the wallet.

§Returns

Returns the generated address as a String if successful, otherwise returns an Error.

§Errors
Source

pub async fn get_balance(&mut self, pin: &EncryptionPin) -> Result<CryptoAmount>

Get the balance of the user

Fetches the balance of the user from the wallet.

§Returns

Returns the balance as a f64 if successful, otherwise returns an Error.

§Errors
Source

pub async fn get_wallet_tx_list( &mut self, pin: &EncryptionPin, start: usize, limit: usize, ) -> Result<WalletTxInfoList>

wallet transaction list

Returns paginated list of wallet transaction list.

§Arguments
  • start - The starting index of transactions to fetch.
  • limit - The number of transactions per page.
§Returns

Returns a WalletTxInfoList containing paginated history of wallet transactions if the outputs are claimed successfully, otherwise returns an Error.

§Errors
Source

pub async fn get_wallet_tx( &mut self, pin: &EncryptionPin, tx_id: &str, ) -> Result<WalletTxInfo>

wallet transaction

Returns the wallet transaction details.

§Arguments
  • tx_id - The transaction id of particular transaction.
§Returns

Returns WalletTxInfo detailed report of particular wallet transaction if the outputs are claimed successfully, otherwise returns an Error.

§Errors
Source§

impl Sdk

Source

pub async fn get_exchange_rate(&self) -> Result<Decimal>

Return the current exchange rate.

§Returns

Returns a Result containing the exchange rate as a Decimal type if successful, or a crate::Error if an error occurs.

Source§

impl Sdk

Source

pub async fn get_recovery_share(&self) -> Result<Option<Share>>

Get/download the recovery share.

§Returns

The recovery share, or None if none exists.

§Error

Returns error if the user is not initialized.

Source

pub async fn set_recovery_share(&mut self, share: Share) -> Result<()>

Set/upload the recovery share.

§Arguments
  • share - The recovery share to upload.
§Error

Returns error if the user is not initialized.

Source§

impl Sdk

Source

pub fn new(config: Config) -> Result<Self>

Initialize an SDK instance from a config

Source

pub async fn set_network(&mut self, network_key: String) -> Result<()>

Set network

Source

pub fn set_networks(&mut self, networks: Vec<ApiNetwork>)

Set networks

Source

pub async fn get_networks(&mut self) -> Result<Vec<ApiNetwork>>

Get networks

Source

pub fn get_build_info() -> String

A function that returns a multi-line String containing:

  • Branch name (e.g. main)
  • Commit hash (e.g. 92cedead),
  • Build time (e.g. 2024-10-29 12:10:09 +00:00),
  • Rust version (e.g. 1.80.1 (3f5fd8dd4 2024-08-06))
  • Toolchain channel (e.g. stable-x86_64-unknown-linux-gnu)

Trait Implementations§

Source§

impl Default for Sdk

Source§

fn default() -> Self

Default implementation for SDK

Source§

impl Drop for Sdk

Source§

fn drop(&mut self)

Drop implementation for SDK

Auto Trait Implementations§

§

impl Freeze for Sdk

§

impl !RefUnwindSafe for Sdk

§

impl Send for Sdk

§

impl Sync for Sdk

§

impl Unpin for Sdk

§

impl !UnwindSafe for Sdk

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
§

impl<T> Conv for T

§

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

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

impl<T> ConvertTo<T> for T
where T: Send,

§

fn convert(self) -> Result<T, Error>

§

fn convert_unchecked(self) -> T

§

impl<T> FmtForward for T

§

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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.

§

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

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

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

impl<T> ErasedDestructor for T
where T: 'static,

§

impl<T> MaybeSendSync for T