Client

Struct Client 

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

Represents a client for the Autonomi network.

§Example

To start interacting with the network, use Client::init.

let client = Client::init().await?;

Implementations§

Source§

impl Client

Source

pub async fn chunk_get(&self, addr: &ChunkAddress) -> Result<Chunk, GetError>

Get a chunk from the network.

Source

pub async fn chunk_put( &self, chunk: &Chunk, payment_option: PaymentOption, ) -> Result<(AttoTokens, ChunkAddress), PutError>

Manually upload a chunk to the network. It is recommended to use the Client::data_put method instead to upload data.

Source

pub async fn chunk_cost( &self, addr: &ChunkAddress, ) -> Result<AttoTokens, CostError>

Get the cost of a chunk.

Source

pub async fn chunk_batch_upload( &self, chunks: Vec<&Chunk>, receipt: &Receipt, ) -> Result<(), PutError>

Upload chunks in batches to the network. This is useful for pre-calculated payment proofs, in case of manual encryption or re-uploading certain chunks that were already paid for.

This method requires a vector of chunks to be uploaded and the payment receipt. It returns a PutError for failures and Ok(()) for successful uploads.

§Example

// Step 1: Encrypt your data using self-encryption
let (data_map, chunks) = autonomi::self_encryption::encrypt("Hello, World!".into())?;

// Step 2: Collect all chunks (datamap + content chunks)
let mut all_chunks = vec![&data_map];
all_chunks.extend(chunks.iter());

// Step 3: Get storage quotes for all chunks
let quote = client.get_store_quotes(
    DataTypes::Chunk,
    all_chunks.iter().map(|chunk| (*chunk.address().xorname(), chunk.size())),
).await?;

// Step 4: Pay for all chunks at once and get receipt
wallet.pay_for_quotes(quote.payments()).await.map_err(|err| err.0)?;
let receipt = autonomi::client::payment::receipt_from_store_quotes(quote);

// Step 5: Upload all chunks with the payment receipt
client.chunk_batch_upload(all_chunks, &receipt).await?;
Source§

impl Client

Source

pub async fn graph_entry_get( &self, address: &GraphEntryAddress, ) -> Result<GraphEntry, GraphError>

Fetches a GraphEntry from the network.

Source

pub async fn graph_entry_check_existence( &self, address: &GraphEntryAddress, ) -> Result<bool, GraphError>

Check if a graph_entry exists on the network This method is much faster than Client::graph_entry_get This may fail if called immediately after creating the graph_entry, as nodes sometimes take longer to store the graph_entry than this request takes to execute!

Source

pub async fn graph_entry_put( &self, entry: GraphEntry, payment_option: PaymentOption, ) -> Result<(AttoTokens, GraphEntryAddress), GraphError>

Manually puts a GraphEntry to the network.

Source

pub async fn graph_entry_cost( &self, key: &PublicKey, ) -> Result<AttoTokens, CostError>

Get the cost to create a GraphEntry

Source§

impl Client

Source

pub async fn pointer_get( &self, address: &PointerAddress, ) -> Result<Pointer, PointerError>

Get a pointer from the network

Source

pub async fn pointer_check_existence( &self, address: &PointerAddress, ) -> Result<bool, PointerError>

Check if a pointer exists on the network This method is much faster than Client::pointer_get This may fail if called immediately after creating the pointer, as nodes sometimes take longer to store the pointer than this request takes to execute!

Source

pub fn pointer_verify(pointer: &Pointer) -> Result<(), PointerError>

Verify a pointer

Source

pub async fn pointer_put( &self, pointer: Pointer, payment_option: PaymentOption, ) -> Result<(AttoTokens, PointerAddress), PointerError>

Manually store a pointer on the network

Source

pub async fn pointer_create( &self, owner: &SecretKey, target: PointerTarget, payment_option: PaymentOption, ) -> Result<(AttoTokens, PointerAddress), PointerError>

Create a new pointer on the network.

Make sure that the owner key is not already used for another pointer as each key is associated with one pointer

Source

pub async fn pointer_update( &self, owner: &SecretKey, target: PointerTarget, ) -> Result<(), PointerError>

Update an existing pointer to point to a new target on the network.

The pointer needs to be created first with Client::pointer_put. This operation is free as the pointer was already paid for at creation. Only the latest version of the pointer is kept on the Network, previous versions will be overwritten and unrecoverable.

Source

pub async fn pointer_update_from( &self, current: &Pointer, owner: &SecretKey, new_target: PointerTarget, ) -> Result<Pointer, PointerError>

Update an existing pointer from a specific pointer

This will increment the counter of the pointer and update the target This function is used internally by Client::pointer_update after the pointer has been retrieved from the network. To skip the retrieval step if you already have the pointer, use this function directly This function will return the new pointer after it has been updated

Source

pub async fn pointer_cost( &self, key: &PublicKey, ) -> Result<AttoTokens, CostError>

Calculate the cost of storing a pointer

Source§

impl Client

Source

pub async fn scratchpad_get_from_public_key( &self, public_key: &PublicKey, ) -> Result<Scratchpad, ScratchpadError>

Get Scratchpad from the Network. A Scratchpad is stored at the owner’s public key so we can derive the address from it.

Source

pub async fn scratchpad_get( &self, address: &ScratchpadAddress, ) -> Result<Scratchpad, ScratchpadError>

Get Scratchpad from the Network

Source

pub async fn scratchpad_check_existence( &self, address: &ScratchpadAddress, ) -> Result<bool, ScratchpadError>

Check if a scratchpad exists on the network This method is much faster than Client::scratchpad_get This may fail if called immediately after creating the scratchpad, as nodes sometimes take longer to store the scratchpad than this request takes to execute!

Source

pub fn scratchpad_verify(scratchpad: &Scratchpad) -> Result<(), ScratchpadError>

Verify a scratchpad

Source

pub async fn scratchpad_put( &self, scratchpad: Scratchpad, payment_option: PaymentOption, ) -> Result<(AttoTokens, ScratchpadAddress), ScratchpadError>

Manually store a scratchpad on the network

Source

pub async fn scratchpad_create( &self, owner: &SecretKey, content_type: u64, initial_data: &Bytes, payment_option: PaymentOption, ) -> Result<(AttoTokens, ScratchpadAddress), ScratchpadError>

Create a new scratchpad to the network.

Make sure that the owner key is not already used for another scratchpad as each key is associated with one scratchpad. The data will be encrypted with the owner key before being stored on the network. The content type is used to identify the type of data stored in the scratchpad, the choice is up to the caller.

Returns the cost and the address of the scratchpad.

Source

pub async fn scratchpad_update( &self, owner: &SecretKey, content_type: u64, data: &Bytes, ) -> Result<(), ScratchpadError>

Update an existing scratchpad to the network. The scratchpad needs to be created first with Client::scratchpad_create. This operation is free as the scratchpad was already paid for at creation. Only the latest version of the scratchpad is kept on the Network, previous versions will be overwritten and unrecoverable.

Source

pub async fn scratchpad_update_from( &self, current: &Scratchpad, owner: &SecretKey, content_type: u64, data: &Bytes, ) -> Result<Scratchpad, ScratchpadError>

Update an existing scratchpad from a specific scratchpad

This will increment the counter of the scratchpad and update the content This function is used internally by Client::scratchpad_update after the scratchpad has been retrieved from the network. To skip the retrieval step if you already have the scratchpad, use this function directly This function will return the new scratchpad after it has been updated

Source

pub async fn scratchpad_put_update( &self, scratchpad: Scratchpad, ) -> Result<(), ScratchpadError>

Store a fully formed, pre-signed scratchpad verbatim after verification. This method is intended for updates and does not require payment.

Preconditions:

  • The scratchpad must already exist on the network
  • The scratchpad signature must be valid (checked by scratchpad_verify)

The scratchpad is stored as-is with no counter increment, re-encryption, or re-signing.

Source

pub async fn scratchpad_cost( &self, owner: &PublicKey, ) -> Result<AttoTokens, CostError>

Get the cost of creating a new Scratchpad

Source§

impl Client

Source

pub async fn data_get(&self, data_map: &DataMapChunk) -> Result<Bytes, GetError>

Fetch a blob of (private) data from the network. In-memory only - fails for large files. Use file_download for large files that need streaming.

§Example
use autonomi::{Client, Bytes};
let data_fetched = client.data_get(&data_map).await?;
Source

pub async fn data_stream( &self, data_map: &DataMapChunk, ) -> Result<DataStream, GetError>

Stream a blob of (private) data from the network. Returns an Iterator that yields chunks progressively. Use this for large blobs of data like videos to avoid loading everything into memory.

§Example
use autonomi::Client;
let stream = client.data_stream(&data_map).await?;
for chunk_result in stream {
    let chunk = chunk_result?;
    // Process chunk...
}
Source

pub async fn data_put( &self, data: Bytes, payment_option: PaymentOption, ) -> Result<(AttoTokens, DataMapChunk), PutError>

Upload a piece of private data to the network. This data will be self-encrypted. The DataMapChunk is not uploaded to the network, keeping the data private.

Returns the DataMapChunk containing the map to the encrypted chunks.

§Example
use autonomi::{Client, Bytes};
let data = Bytes::from("Hello, World");
let (total_cost, data_map) = client.data_put(data, wallet).await?;
let data_fetched = client.data_get(&data_map).await?;
assert_eq!(data, data_fetched);
Source§

impl Client

Source

pub async fn data_get_public( &self, addr: &DataAddress, ) -> Result<Bytes, GetError>

Fetch a blob of public data from the network. In-memory only - fails for large files. Use file_download_public for large files that need streaming.

Source

pub async fn data_stream_public( &self, addr: &DataAddress, ) -> Result<DataStream, GetError>

Stream a blob of public data from the network. Returns an Iterator that yields chunks progressively. Use this for large blobs of data like videos to avoid loading everything into memory.

§Example
use autonomi::Client;
let stream = client.data_stream_public(&addr).await?;
for chunk_result in stream {
    let chunk = chunk_result?;
    // Process chunk...
}
Source

pub async fn data_put_public( &self, data: Bytes, payment_option: PaymentOption, ) -> Result<(AttoTokens, DataAddress), PutError>

Upload a piece of data to the network. This data is publicly accessible.

Returns the Data Address at which the data was stored.

Source

pub async fn data_cost(&self, data: Bytes) -> Result<AttoTokens, CostError>

Get the estimated cost of storing a piece of data.

Source

pub async fn get_cost_estimation( &self, content_addrs: Vec<(XorName, usize)>, ) -> Result<AttoTokens, CostError>

Get the estimated cost of content addresses.

Source§

impl Client

Source

pub async fn archive_get( &self, addr: &PrivateArchiveDataMap, ) -> Result<PrivateArchive, GetError>

Fetch a PrivateArchive from the network

Source

pub async fn archive_put( &self, archive: &PrivateArchive, payment_option: PaymentOption, ) -> Result<(AttoTokens, PrivateArchiveDataMap), PutError>

Upload a PrivateArchive to the network

Source§

impl Client

Source

pub async fn archive_get_public( &self, addr: &ArchiveAddress, ) -> Result<PublicArchive, GetError>

Fetch an archive from the network

§Example
let client = Client::init().await?;
let addr = ArchiveAddress::new(XorName::random(&mut rand::thread_rng()));
let archive = client.archive_get_public(&addr).await?;
Source

pub async fn archive_put_public( &self, archive: &PublicArchive, payment_option: PaymentOption, ) -> Result<(AttoTokens, ArchiveAddress), PutError>

Upload an archive to the network

§Example

Create simple archive containing file.txt pointing to random XOR name.

let mut archive = PublicArchive::new();
let data_addr = DataAddress::new(XorName::random(&mut rand::thread_rng()));
archive.add_file(PathBuf::from("file.txt"), data_addr, Metadata::new_with_size(0));
let (cost, address) = client.archive_put_public(&archive, payment).await?;
Source

pub async fn archive_cost( &self, archive: &PublicArchive, ) -> Result<AttoTokens, CostError>

Get the cost to upload an archive

Source§

impl Client

Source

pub async fn file_download( &self, data_map: &DataMapChunk, to_dest: PathBuf, ) -> Result<(), DownloadError>

Download private file directly to filesystem. Always uses streaming.

Source

pub async fn dir_download( &self, archive_access: &PrivateArchiveDataMap, to_dest: PathBuf, ) -> Result<(), DownloadError>

Download a private directory from network to local file system

Source

pub async fn dir_content_upload( &self, dir_path: PathBuf, payment_option: PaymentOption, ) -> Result<(AttoTokens, PrivateArchive), UploadError>

Upload the content of all files in a directory to the network. The directory is recursively walked and each file is uploaded to the network.

The datamaps of these (private) files are not uploaded but returned within the PrivateArchive return type.

Source

pub async fn dir_upload( &self, dir_path: PathBuf, payment_option: PaymentOption, ) -> Result<(AttoTokens, PrivateArchiveDataMap), UploadError>

Same as Client::dir_content_upload but also uploads the archive (privately) to the network.

Returns the PrivateArchiveDataMap allowing the private archive to be downloaded from the network.

Source

pub async fn file_content_upload( &self, path: PathBuf, payment_option: PaymentOption, ) -> Result<(AttoTokens, DataMapChunk), UploadError>

Upload the content of a private file to the network. Reads file, splits into chunks, uploads chunks, uploads datamap, returns DataMapChunk (pointing to the datamap)

Source§

impl Client

Source

pub async fn file_download_public( &self, data_addr: &DataAddress, to_dest: PathBuf, ) -> Result<(), DownloadError>

Download file from network to local file system

Source

pub async fn dir_download_public( &self, archive_addr: &ArchiveAddress, to_dest: PathBuf, ) -> Result<(), DownloadError>

Download directory from network to local file system

Source

pub async fn dir_content_upload_public( &self, dir_path: PathBuf, payment_option: PaymentOption, ) -> Result<(AttoTokens, PublicArchive), UploadError>

Upload the content of all files in a directory to the network. The directory is recursively walked and each file is uploaded to the network.

The datamaps of these files are uploaded on the network, making the individual files publicly available.

This returns, but does not upload (!),the PublicArchive containing the datamaps of the uploaded files.

Source

pub async fn dir_upload_public( &self, dir_path: PathBuf, payment_option: PaymentOption, ) -> Result<(AttoTokens, ArchiveAddress), UploadError>

Same as Client::dir_content_upload_public but also uploads the archive to the network.

Returns the ArchiveAddress of the uploaded archive.

Source

pub async fn file_content_upload_public( &self, path: PathBuf, payment_option: PaymentOption, ) -> Result<(AttoTokens, DataAddress), UploadError>

Upload the content of a file to the network. Reads file, splits into chunks, uploads chunks, uploads datamap, returns DataAddr (pointing to the datamap)

Source

pub async fn file_cost( &self, path: &PathBuf, ) -> Result<AttoTokens, FileCostError>

Get the cost to upload a file/dir to the network. quick and dirty implementation, please refactor once files are cleanly implemented

Source§

impl Client

Source

pub async fn vault_get_user_data( &self, secret_key: &VaultSecretKey, ) -> Result<UserData, UserDataVaultError>

Get the user data from the vault

Source

pub async fn vault_put_user_data( &self, secret_key: &VaultSecretKey, payment_option: PaymentOption, user_data: UserData, ) -> Result<AttoTokens, UserDataVaultError>

Put the user data to the vault

Returns the total cost of the put operation

Source

pub async fn get_user_data_from_vault( &self, secret_key: &VaultSecretKey, ) -> Result<UserData, UserDataVaultError>

👎Deprecated since 0.2.0: Use vault_get_user_data instead

@deprecated Use vault_get_user_data instead. This function will be removed in a future version.

Source

pub async fn put_user_data_to_vault( &self, secret_key: &VaultSecretKey, payment_option: PaymentOption, user_data: UserData, ) -> Result<AttoTokens, UserDataVaultError>

👎Deprecated since 0.2.0: Use vault_put_user_data instead

@deprecated Use vault_put_user_data instead. This function will be removed in a future version.

Source§

impl Client

Source

pub async fn vault_get( &self, secret_key: &VaultSecretKey, ) -> Result<(Bytes, VaultContentType), VaultError>

Retrieves and returns a decrypted vault if one exists.

Returns the content type of the bytes in the vault.

Source

pub async fn vault_cost( &self, owner: &VaultSecretKey, max_size: u64, ) -> Result<AttoTokens, VaultError>

Get the cost of creating a new vault A quick estimation of cost: num_of_graph_entry * graph_entry_cost + num_of_scratchpad * scratchpad_cost

Source

pub async fn vault_put( &self, data: Bytes, payment_option: PaymentOption, secret_key: &VaultSecretKey, content_type: VaultContentType, ) -> Result<AttoTokens, VaultError>

Put data into the client’s VaultPacket

Dynamically expand the vault capacity by paying for more space (Scratchpad) when needed.

It is recommended to use the hash of the app name or unique identifier as the content type.

Source

pub async fn vault_expand_capacity( &self, main_secret_key: &MainSecretKey, cur_graphentry_derivation: &DerivationIndex, payment_option: PaymentOption, ) -> Result<(DerivationIndex, Vec<(PublicKey, GraphContent)>, AttoTokens), VaultError>

Source

pub async fn vault_claimed_capacity( &self, main_secret_key: &MainSecretKey, cur_free_graphentry_derivation: DerivationIndex, ) -> Result<(DerivationIndex, Vec<(PublicKey, GraphContent)>), VaultError>

Source

pub async fn fetch_and_decrypt_vault( &self, secret_key: &VaultSecretKey, ) -> Result<(Bytes, VaultContentType), VaultError>

👎Deprecated since 0.2.0: Use vault_get instead

@deprecated Use vault_get instead. This function will be removed in a future version.

Source

pub async fn write_bytes_to_vault( &self, data: Bytes, payment_option: PaymentOption, secret_key: &VaultSecretKey, content_type: VaultContentType, ) -> Result<AttoTokens, VaultError>

👎Deprecated since 0.2.0: Use vault_put instead

@deprecated Use vault_put instead. This function will be removed in a future version.

Source§

impl Client

Source

pub fn register_history(&self, addr: &RegisterAddress) -> RegisterHistory

Get the register history, starting from the root to the latest entry.

This returns a RegisterHistory that can be use to get the register values from the history.

RegisterHistory::next can be used to get the values one by one, from the first to the latest entry. RegisterHistory::collect can be used to get all the register values from the history from the first to the latest entry.

Source§

impl Client

Source

pub fn register_key_from_name(owner: &SecretKey, name: &str) -> SecretKey

Create a new register key from a SecretKey and a name.

This derives a new SecretKey from the owner’s SecretKey using the name. Note that you will need to keep track of the names you used to create the register key.

Source

pub fn register_value_from_bytes( bytes: &[u8], ) -> Result<RegisterValue, RegisterError>

Create a new RegisterValue from bytes, make sure the bytes are not longer than REGISTER_VALUE_SIZE

Source

pub async fn register_create( &self, owner: &SecretKey, initial_value: RegisterValue, payment_option: PaymentOption, ) -> Result<(AttoTokens, RegisterAddress), RegisterError>

Create a new register with an initial value.

Note that two payments are required, one for the underlying GraphEntry and one for the crate::Pointer

Source

pub async fn register_update( &self, owner: &SecretKey, new_value: RegisterValue, payment_option: PaymentOption, ) -> Result<AttoTokens, RegisterError>

Update the value of a register.

The register needs to be created first with Client::register_create

Source

pub async fn register_get( &self, addr: &RegisterAddress, ) -> Result<RegisterValue, RegisterError>

Get the current value of the register

Source

pub async fn register_cost( &self, owner: &PublicKey, ) -> Result<AttoTokens, CostError>

Get the cost of a register operation. Returns the cost of creation if it doesn’t exist, else returns the cost of an update

Source§

impl Client

Source

pub async fn analyze_address( &self, address: &str, verbose: bool, ) -> Result<Analysis, AnalysisError>

Analyze an address and return the type of the address. Can be run in verbose mode to make it talkative (will print information as it works).

Source

pub async fn analyze_address_recursively( &self, address: &str, verbose: bool, ) -> HashMap<String, Result<Analysis, AnalysisError>>

Analyze an address recursively by following all discovered addresses. Returns the list of analyses found. Can be run in verbose mode to make it talkative (will print information as it works).

Source

pub async fn analyze_address_type( &self, address: &str, verbose: bool, ) -> Result<PointerTarget, AnalysisError>

Analyze an address and return the address type (Chunk, Pointer, GraphEntry, Scratchpad)

Source§

impl Client

Source

pub async fn get_raw_quotes( &self, data_type: DataTypes, content_addrs: impl Iterator<Item = (XorName, usize)>, ) -> Vec<Result<(XorName, Vec<(PeerId, Addresses, PaymentQuote)>), CostError>>

Get raw quotes from nodes. These quotes do not include actual record prices. You will likely want to use get_store_quotes instead.

Source

pub async fn get_raw_quote_from_peer( &self, content_addr: XorName, peer: PeerInfo, data_type: DataTypes, data_size: usize, ) -> Result<Option<(PeerId, Addresses, PaymentQuote)>, CostError>

Get a raw quote from a specific peer. This quote does not include actual record prices. Returns None if the record already exists and no payment is needed.

Can also be used to get a reward address from a specific peer as it will be embedded in the quote.

Source

pub async fn get_store_quotes( &self, data_type: DataTypes, content_addrs: impl Iterator<Item = (XorName, usize)>, ) -> Result<StoreQuote, CostError>

Source§

impl Client

Source

pub async fn get_quotes_for_content_addresses( &self, data_type: DataTypes, content_addrs: impl Iterator<Item = (XorName, usize)> + Clone, ) -> Result<(HashMap<XorName, QuoteForAddress>, Vec<QuotePayment>, Vec<XorName>), PutError>

Available on crate feature external-signer only.

Get quotes for data. Returns a cost map, data payments to be executed and a list of free (already paid for) chunks.

Source§

impl Client

Source

pub fn deserialize_data_map(data_map_bytes: &Bytes) -> Result<DataMap, GetError>

Deserialize datamap from bytes, handling both old and new formats

Source§

impl Client

Source

pub async fn get_closest_to_address( &self, network_address: impl Into<NetworkAddress>, count: Option<usize>, ) -> Result<Vec<PeerInfo>, NetworkError>

Retrieve the closest peers to the given network address.

Optionally specify a count of peers to retrieve; if None, CLOSE_GROUP+2 peers will be returned.

Source

pub async fn get_record_from_peer( &self, network_address: impl Into<NetworkAddress>, peer: PeerInfo, ) -> Result<Option<Record>, NetworkError>

Get a record directly from a specific peer. Returns:

  • Some(Record) if the peer holds the record
  • None if the peer doesn’t hold the record or the request fails
Source

pub async fn get_record_and_holders( &self, network_address: impl Into<NetworkAddress>, quorum: Quorum, ) -> Result<(Option<Record>, Vec<PeerId>), NetworkError>

Get a record from the network and the list of peers holding it. Returns the record if successful along with the peers that handed it to us. If the record is not found, the result will be None and an empty list of peers. If the Quorum is not met, the result will be None and the list of peers that did manage to deliver the record. As soon as the quorum is met, the request will complete and the result will be returned. Note that the holders returned is not an exhaustive list of all holders of the record, it only contains the peers that responded to the request before the quorum was met.

Source

pub async fn get_storage_proofs_from_peer( &self, network_address: impl Into<NetworkAddress>, peer: PeerInfo, nonce: u64, difficulty: usize, ) -> Result<Vec<(NetworkAddress, Result<ChunkProof, Error>)>, NetworkError>

Get storage proofs directly from a specific peer. Returns a vector of (NetworkAddress, ChunkProof) tuples

Source

pub async fn get_node_version( &self, peer: PeerInfo, ) -> Result<PackageVersion, String>

Source§

impl Client

Source

pub async fn init() -> Result<Self, ConnectError>

Initialize the client with default configuration.

See Client::init_with_config.

Source

pub async fn init_local() -> Result<Self, ConnectError>

Initialize a client that is configured to be local.

See Client::init_with_config.

Source

pub async fn init_alpha() -> Result<Self, ConnectError>

Initialize a client that is configured to be connected to the the alpha network (Impossible Futures).

Source

pub async fn init_with_peers( peers: Vec<Multiaddr>, ) -> Result<Self, ConnectError>

Initialize a client that bootstraps from a list of peers.

If any of the provided peers is a global address, the client will not be local.

// Will set `local` to true.
let client = Client::init_with_peers(vec!["/ip4/127.0.0.1/udp/1234/quic-v1".parse()?]).await?;
Source

pub async fn init_with_config( config: ClientConfig, ) -> Result<Self, ConnectError>

Initialize the client with the given configuration.

This will block until CLOSE_GROUP_SIZE have been added to the routing table.

See ClientConfig.

use autonomi::client::Client;
let client = Client::init_with_config(Default::default()).await?;
Source

pub fn with_strategy(self, strategy: ClientOperatingStrategy) -> Self

Set the ClientOperatingStrategy for the client.

Source

pub fn with_retry_failed(self, retry_failed: u64) -> Self

Set whether to retry failed uploads automatically.

Source

pub fn with_payment_mode(self, payment_mode: PaymentMode) -> Self

Set the payment mode for uploads.

Source

pub fn enable_client_events(&mut self) -> Receiver<ClientEvent>

Receive events from the client.

Source

pub fn evm_network(&self) -> &EvmNetwork

Get the evm network.

Trait Implementations§

Source§

impl Clone for Client

Source§

fn clone(&self) -> Client

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 Debug for Client

Source§

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

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl Freeze for Client

§

impl RefUnwindSafe for Client

§

impl Send for Client

§

impl Sync for Client

§

impl Unpin for Client

§

impl UnwindSafe for Client

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<'a, T, E> AsTaggedExplicit<'a, E> for T
where T: 'a,

Source§

fn explicit(self, class: Class, tag: u32) -> TaggedParser<'a, Explicit, Self, E>

Source§

impl<'a, T, E> AsTaggedImplicit<'a, E> for T
where T: 'a,

Source§

fn implicit( self, class: Class, constructed: bool, tag: u32, ) -> TaggedParser<'a, Implicit, Self, E>

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> DynClone for T
where T: Clone,

Source§

fn __clone_box(&self, _: Private) -> *mut ()

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> 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<D> OwoColorize for D

Source§

fn fg<C>(&self) -> FgColorDisplay<'_, C, Self>
where C: Color,

Set the foreground color generically Read more
Source§

fn bg<C>(&self) -> BgColorDisplay<'_, C, Self>
where C: Color,

Set the background color generically. Read more
Source§

fn black(&self) -> FgColorDisplay<'_, Black, Self>

Change the foreground color to black
Source§

fn on_black(&self) -> BgColorDisplay<'_, Black, Self>

Change the background color to black
Source§

fn red(&self) -> FgColorDisplay<'_, Red, Self>

Change the foreground color to red
Source§

fn on_red(&self) -> BgColorDisplay<'_, Red, Self>

Change the background color to red
Source§

fn green(&self) -> FgColorDisplay<'_, Green, Self>

Change the foreground color to green
Source§

fn on_green(&self) -> BgColorDisplay<'_, Green, Self>

Change the background color to green
Source§

fn yellow(&self) -> FgColorDisplay<'_, Yellow, Self>

Change the foreground color to yellow
Source§

fn on_yellow(&self) -> BgColorDisplay<'_, Yellow, Self>

Change the background color to yellow
Source§

fn blue(&self) -> FgColorDisplay<'_, Blue, Self>

Change the foreground color to blue
Source§

fn on_blue(&self) -> BgColorDisplay<'_, Blue, Self>

Change the background color to blue
Source§

fn magenta(&self) -> FgColorDisplay<'_, Magenta, Self>

Change the foreground color to magenta
Source§

fn on_magenta(&self) -> BgColorDisplay<'_, Magenta, Self>

Change the background color to magenta
Source§

fn purple(&self) -> FgColorDisplay<'_, Magenta, Self>

Change the foreground color to purple
Source§

fn on_purple(&self) -> BgColorDisplay<'_, Magenta, Self>

Change the background color to purple
Source§

fn cyan(&self) -> FgColorDisplay<'_, Cyan, Self>

Change the foreground color to cyan
Source§

fn on_cyan(&self) -> BgColorDisplay<'_, Cyan, Self>

Change the background color to cyan
Source§

fn white(&self) -> FgColorDisplay<'_, White, Self>

Change the foreground color to white
Source§

fn on_white(&self) -> BgColorDisplay<'_, White, Self>

Change the background color to white
Source§

fn default_color(&self) -> FgColorDisplay<'_, Default, Self>

Change the foreground color to the terminal default
Source§

fn on_default_color(&self) -> BgColorDisplay<'_, Default, Self>

Change the background color to the terminal default
Source§

fn bright_black(&self) -> FgColorDisplay<'_, BrightBlack, Self>

Change the foreground color to bright black
Source§

fn on_bright_black(&self) -> BgColorDisplay<'_, BrightBlack, Self>

Change the background color to bright black
Source§

fn bright_red(&self) -> FgColorDisplay<'_, BrightRed, Self>

Change the foreground color to bright red
Source§

fn on_bright_red(&self) -> BgColorDisplay<'_, BrightRed, Self>

Change the background color to bright red
Source§

fn bright_green(&self) -> FgColorDisplay<'_, BrightGreen, Self>

Change the foreground color to bright green
Source§

fn on_bright_green(&self) -> BgColorDisplay<'_, BrightGreen, Self>

Change the background color to bright green
Source§

fn bright_yellow(&self) -> FgColorDisplay<'_, BrightYellow, Self>

Change the foreground color to bright yellow
Source§

fn on_bright_yellow(&self) -> BgColorDisplay<'_, BrightYellow, Self>

Change the background color to bright yellow
Source§

fn bright_blue(&self) -> FgColorDisplay<'_, BrightBlue, Self>

Change the foreground color to bright blue
Source§

fn on_bright_blue(&self) -> BgColorDisplay<'_, BrightBlue, Self>

Change the background color to bright blue
Source§

fn bright_magenta(&self) -> FgColorDisplay<'_, BrightMagenta, Self>

Change the foreground color to bright magenta
Source§

fn on_bright_magenta(&self) -> BgColorDisplay<'_, BrightMagenta, Self>

Change the background color to bright magenta
Source§

fn bright_purple(&self) -> FgColorDisplay<'_, BrightMagenta, Self>

Change the foreground color to bright purple
Source§

fn on_bright_purple(&self) -> BgColorDisplay<'_, BrightMagenta, Self>

Change the background color to bright purple
Source§

fn bright_cyan(&self) -> FgColorDisplay<'_, BrightCyan, Self>

Change the foreground color to bright cyan
Source§

fn on_bright_cyan(&self) -> BgColorDisplay<'_, BrightCyan, Self>

Change the background color to bright cyan
Source§

fn bright_white(&self) -> FgColorDisplay<'_, BrightWhite, Self>

Change the foreground color to bright white
Source§

fn on_bright_white(&self) -> BgColorDisplay<'_, BrightWhite, Self>

Change the background color to bright white
Source§

fn bold(&self) -> BoldDisplay<'_, Self>

Make the text bold
Source§

fn dimmed(&self) -> DimDisplay<'_, Self>

Make the text dim
Source§

fn italic(&self) -> ItalicDisplay<'_, Self>

Make the text italicized
Source§

fn underline(&self) -> UnderlineDisplay<'_, Self>

Make the text underlined
Make the text blink
Make the text blink (but fast!)
Source§

fn reversed(&self) -> ReversedDisplay<'_, Self>

Swap the foreground and background colors
Source§

fn hidden(&self) -> HiddenDisplay<'_, Self>

Hide the text
Source§

fn strikethrough(&self) -> StrikeThroughDisplay<'_, Self>

Cross out the text
Source§

fn color<Color>(&self, color: Color) -> FgDynColorDisplay<'_, Color, Self>
where Color: DynColor,

Set the foreground color at runtime. Only use if you do not know which color will be used at compile-time. If the color is constant, use either OwoColorize::fg or a color-specific method, such as OwoColorize::green, Read more
Source§

fn on_color<Color>(&self, color: Color) -> BgDynColorDisplay<'_, Color, Self>
where Color: DynColor,

Set the background color at runtime. Only use if you do not know what color to use at compile-time. If the color is constant, use either OwoColorize::bg or a color-specific method, such as OwoColorize::on_yellow, Read more
Source§

fn fg_rgb<const R: u8, const G: u8, const B: u8>( &self, ) -> FgColorDisplay<'_, CustomColor<R, G, B>, Self>

Set the foreground color to a specific RGB value.
Source§

fn bg_rgb<const R: u8, const G: u8, const B: u8>( &self, ) -> BgColorDisplay<'_, CustomColor<R, G, B>, Self>

Set the background color to a specific RGB value.
Source§

fn truecolor(&self, r: u8, g: u8, b: u8) -> FgDynColorDisplay<'_, Rgb, Self>

Sets the foreground color to an RGB value.
Source§

fn on_truecolor(&self, r: u8, g: u8, b: u8) -> BgDynColorDisplay<'_, Rgb, Self>

Sets the background color to an RGB value.
Source§

fn style(&self, style: Style) -> Styled<&Self>

Apply a runtime-determined style
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> PolicyExt for T
where T: ?Sized,

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: 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
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: 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
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
Source§

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