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
impl Client
Sourcepub async fn chunk_get(&self, addr: &ChunkAddress) -> Result<Chunk, GetError>
pub async fn chunk_get(&self, addr: &ChunkAddress) -> Result<Chunk, GetError>
Get a chunk from the network.
Sourcepub async fn chunk_put(
&self,
chunk: &Chunk,
payment_option: PaymentOption,
) -> Result<(AttoTokens, ChunkAddress), PutError>
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.
Sourcepub async fn chunk_cost(
&self,
addr: &ChunkAddress,
) -> Result<AttoTokens, CostError>
pub async fn chunk_cost( &self, addr: &ChunkAddress, ) -> Result<AttoTokens, CostError>
Get the cost of a chunk.
Sourcepub async fn chunk_batch_upload(
&self,
chunks: Vec<&Chunk>,
receipt: &Receipt,
) -> Result<(), PutError>
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
impl Client
Sourcepub async fn graph_entry_get(
&self,
address: &GraphEntryAddress,
) -> Result<GraphEntry, GraphError>
pub async fn graph_entry_get( &self, address: &GraphEntryAddress, ) -> Result<GraphEntry, GraphError>
Fetches a GraphEntry from the network.
Sourcepub async fn graph_entry_check_existence(
&self,
address: &GraphEntryAddress,
) -> Result<bool, GraphError>
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!
Sourcepub async fn graph_entry_put(
&self,
entry: GraphEntry,
payment_option: PaymentOption,
) -> Result<(AttoTokens, GraphEntryAddress), GraphError>
pub async fn graph_entry_put( &self, entry: GraphEntry, payment_option: PaymentOption, ) -> Result<(AttoTokens, GraphEntryAddress), GraphError>
Manually puts a GraphEntry to the network.
Sourcepub async fn graph_entry_cost(
&self,
key: &PublicKey,
) -> Result<AttoTokens, CostError>
pub async fn graph_entry_cost( &self, key: &PublicKey, ) -> Result<AttoTokens, CostError>
Get the cost to create a GraphEntry
Source§impl Client
impl Client
Sourcepub async fn pointer_get(
&self,
address: &PointerAddress,
) -> Result<Pointer, PointerError>
pub async fn pointer_get( &self, address: &PointerAddress, ) -> Result<Pointer, PointerError>
Get a pointer from the network
Sourcepub async fn pointer_check_existence(
&self,
address: &PointerAddress,
) -> Result<bool, PointerError>
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!
Sourcepub fn pointer_verify(pointer: &Pointer) -> Result<(), PointerError>
pub fn pointer_verify(pointer: &Pointer) -> Result<(), PointerError>
Verify a pointer
Sourcepub async fn pointer_put(
&self,
pointer: Pointer,
payment_option: PaymentOption,
) -> Result<(AttoTokens, PointerAddress), PointerError>
pub async fn pointer_put( &self, pointer: Pointer, payment_option: PaymentOption, ) -> Result<(AttoTokens, PointerAddress), PointerError>
Manually store a pointer on the network
Sourcepub async fn pointer_create(
&self,
owner: &SecretKey,
target: PointerTarget,
payment_option: PaymentOption,
) -> Result<(AttoTokens, PointerAddress), PointerError>
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
Sourcepub async fn pointer_update(
&self,
owner: &SecretKey,
target: PointerTarget,
) -> Result<(), PointerError>
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.
Sourcepub async fn pointer_update_from(
&self,
current: &Pointer,
owner: &SecretKey,
new_target: PointerTarget,
) -> Result<Pointer, PointerError>
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
Sourcepub async fn pointer_cost(
&self,
key: &PublicKey,
) -> Result<AttoTokens, CostError>
pub async fn pointer_cost( &self, key: &PublicKey, ) -> Result<AttoTokens, CostError>
Calculate the cost of storing a pointer
Source§impl Client
impl Client
Sourcepub async fn scratchpad_get_from_public_key(
&self,
public_key: &PublicKey,
) -> Result<Scratchpad, ScratchpadError>
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.
Sourcepub async fn scratchpad_get(
&self,
address: &ScratchpadAddress,
) -> Result<Scratchpad, ScratchpadError>
pub async fn scratchpad_get( &self, address: &ScratchpadAddress, ) -> Result<Scratchpad, ScratchpadError>
Get Scratchpad from the Network
Sourcepub async fn scratchpad_check_existence(
&self,
address: &ScratchpadAddress,
) -> Result<bool, ScratchpadError>
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!
Sourcepub fn scratchpad_verify(scratchpad: &Scratchpad) -> Result<(), ScratchpadError>
pub fn scratchpad_verify(scratchpad: &Scratchpad) -> Result<(), ScratchpadError>
Verify a scratchpad
Sourcepub async fn scratchpad_put(
&self,
scratchpad: Scratchpad,
payment_option: PaymentOption,
) -> Result<(AttoTokens, ScratchpadAddress), ScratchpadError>
pub async fn scratchpad_put( &self, scratchpad: Scratchpad, payment_option: PaymentOption, ) -> Result<(AttoTokens, ScratchpadAddress), ScratchpadError>
Manually store a scratchpad on the network
Sourcepub async fn scratchpad_create(
&self,
owner: &SecretKey,
content_type: u64,
initial_data: &Bytes,
payment_option: PaymentOption,
) -> Result<(AttoTokens, ScratchpadAddress), ScratchpadError>
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.
Sourcepub async fn scratchpad_update(
&self,
owner: &SecretKey,
content_type: u64,
data: &Bytes,
) -> Result<(), ScratchpadError>
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.
Sourcepub async fn scratchpad_update_from(
&self,
current: &Scratchpad,
owner: &SecretKey,
content_type: u64,
data: &Bytes,
) -> Result<Scratchpad, ScratchpadError>
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
Sourcepub async fn scratchpad_put_update(
&self,
scratchpad: Scratchpad,
) -> Result<(), ScratchpadError>
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.
Sourcepub async fn scratchpad_cost(
&self,
owner: &PublicKey,
) -> Result<AttoTokens, CostError>
pub async fn scratchpad_cost( &self, owner: &PublicKey, ) -> Result<AttoTokens, CostError>
Get the cost of creating a new Scratchpad
Source§impl Client
impl Client
Sourcepub async fn data_get(&self, data_map: &DataMapChunk) -> Result<Bytes, GetError>
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?;Sourcepub async fn data_stream(
&self,
data_map: &DataMapChunk,
) -> Result<DataStream, GetError>
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...
}Sourcepub async fn data_put(
&self,
data: Bytes,
payment_option: PaymentOption,
) -> Result<(AttoTokens, DataMapChunk), PutError>
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
impl Client
Sourcepub async fn data_get_public(
&self,
addr: &DataAddress,
) -> Result<Bytes, GetError>
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.
Sourcepub async fn data_stream_public(
&self,
addr: &DataAddress,
) -> Result<DataStream, GetError>
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...
}Sourcepub async fn data_put_public(
&self,
data: Bytes,
payment_option: PaymentOption,
) -> Result<(AttoTokens, DataAddress), PutError>
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.
Sourcepub async fn data_cost(&self, data: Bytes) -> Result<AttoTokens, CostError>
pub async fn data_cost(&self, data: Bytes) -> Result<AttoTokens, CostError>
Get the estimated cost of storing a piece of data.
Sourcepub async fn get_cost_estimation(
&self,
content_addrs: Vec<(XorName, usize)>,
) -> Result<AttoTokens, CostError>
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
impl Client
Sourcepub async fn archive_get(
&self,
addr: &PrivateArchiveDataMap,
) -> Result<PrivateArchive, GetError>
pub async fn archive_get( &self, addr: &PrivateArchiveDataMap, ) -> Result<PrivateArchive, GetError>
Fetch a PrivateArchive from the network
Sourcepub async fn archive_put(
&self,
archive: &PrivateArchive,
payment_option: PaymentOption,
) -> Result<(AttoTokens, PrivateArchiveDataMap), PutError>
pub async fn archive_put( &self, archive: &PrivateArchive, payment_option: PaymentOption, ) -> Result<(AttoTokens, PrivateArchiveDataMap), PutError>
Upload a PrivateArchive to the network
Source§impl Client
impl Client
Sourcepub async fn archive_get_public(
&self,
addr: &ArchiveAddress,
) -> Result<PublicArchive, GetError>
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?;Sourcepub async fn archive_put_public(
&self,
archive: &PublicArchive,
payment_option: PaymentOption,
) -> Result<(AttoTokens, ArchiveAddress), PutError>
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?;Sourcepub async fn archive_cost(
&self,
archive: &PublicArchive,
) -> Result<AttoTokens, CostError>
pub async fn archive_cost( &self, archive: &PublicArchive, ) -> Result<AttoTokens, CostError>
Get the cost to upload an archive
Source§impl Client
impl Client
Sourcepub async fn file_download(
&self,
data_map: &DataMapChunk,
to_dest: PathBuf,
) -> Result<(), DownloadError>
pub async fn file_download( &self, data_map: &DataMapChunk, to_dest: PathBuf, ) -> Result<(), DownloadError>
Download private file directly to filesystem. Always uses streaming.
Sourcepub async fn dir_download(
&self,
archive_access: &PrivateArchiveDataMap,
to_dest: PathBuf,
) -> Result<(), DownloadError>
pub async fn dir_download( &self, archive_access: &PrivateArchiveDataMap, to_dest: PathBuf, ) -> Result<(), DownloadError>
Download a private directory from network to local file system
Sourcepub async fn dir_content_upload(
&self,
dir_path: PathBuf,
payment_option: PaymentOption,
) -> Result<(AttoTokens, PrivateArchive), UploadError>
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.
Sourcepub async fn dir_upload(
&self,
dir_path: PathBuf,
payment_option: PaymentOption,
) -> Result<(AttoTokens, PrivateArchiveDataMap), UploadError>
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.
Sourcepub async fn file_content_upload(
&self,
path: PathBuf,
payment_option: PaymentOption,
) -> Result<(AttoTokens, DataMapChunk), UploadError>
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
impl Client
Sourcepub async fn file_download_public(
&self,
data_addr: &DataAddress,
to_dest: PathBuf,
) -> Result<(), DownloadError>
pub async fn file_download_public( &self, data_addr: &DataAddress, to_dest: PathBuf, ) -> Result<(), DownloadError>
Download file from network to local file system
Sourcepub async fn dir_download_public(
&self,
archive_addr: &ArchiveAddress,
to_dest: PathBuf,
) -> Result<(), DownloadError>
pub async fn dir_download_public( &self, archive_addr: &ArchiveAddress, to_dest: PathBuf, ) -> Result<(), DownloadError>
Download directory from network to local file system
Sourcepub async fn dir_content_upload_public(
&self,
dir_path: PathBuf,
payment_option: PaymentOption,
) -> Result<(AttoTokens, PublicArchive), UploadError>
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.
Sourcepub async fn dir_upload_public(
&self,
dir_path: PathBuf,
payment_option: PaymentOption,
) -> Result<(AttoTokens, ArchiveAddress), UploadError>
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.
Sourcepub async fn file_content_upload_public(
&self,
path: PathBuf,
payment_option: PaymentOption,
) -> Result<(AttoTokens, DataAddress), UploadError>
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)
Sourcepub async fn file_cost(
&self,
path: &PathBuf,
) -> Result<AttoTokens, FileCostError>
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
impl Client
Sourcepub async fn vault_get_user_data(
&self,
secret_key: &VaultSecretKey,
) -> Result<UserData, UserDataVaultError>
pub async fn vault_get_user_data( &self, secret_key: &VaultSecretKey, ) -> Result<UserData, UserDataVaultError>
Get the user data from the vault
Sourcepub async fn vault_put_user_data(
&self,
secret_key: &VaultSecretKey,
payment_option: PaymentOption,
user_data: UserData,
) -> Result<AttoTokens, UserDataVaultError>
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
Sourcepub 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
pub async fn get_user_data_from_vault( &self, secret_key: &VaultSecretKey, ) -> Result<UserData, UserDataVaultError>
vault_get_user_data instead@deprecated Use vault_get_user_data instead. This function will be removed in a future version.
Sourcepub 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
pub async fn put_user_data_to_vault( &self, secret_key: &VaultSecretKey, payment_option: PaymentOption, user_data: UserData, ) -> Result<AttoTokens, UserDataVaultError>
vault_put_user_data instead@deprecated Use vault_put_user_data instead. This function will be removed in a future version.
Source§impl Client
impl Client
Sourcepub async fn vault_get(
&self,
secret_key: &VaultSecretKey,
) -> Result<(Bytes, VaultContentType), VaultError>
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.
Sourcepub async fn vault_cost(
&self,
owner: &VaultSecretKey,
max_size: u64,
) -> Result<AttoTokens, VaultError>
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
Sourcepub async fn vault_put(
&self,
data: Bytes,
payment_option: PaymentOption,
secret_key: &VaultSecretKey,
content_type: VaultContentType,
) -> Result<AttoTokens, VaultError>
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.
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>
pub async fn vault_claimed_capacity( &self, main_secret_key: &MainSecretKey, cur_free_graphentry_derivation: DerivationIndex, ) -> Result<(DerivationIndex, Vec<(PublicKey, GraphContent)>), VaultError>
Sourcepub async fn fetch_and_decrypt_vault(
&self,
secret_key: &VaultSecretKey,
) -> Result<(Bytes, VaultContentType), VaultError>
👎Deprecated since 0.2.0: Use vault_get instead
pub async fn fetch_and_decrypt_vault( &self, secret_key: &VaultSecretKey, ) -> Result<(Bytes, VaultContentType), VaultError>
vault_get instead@deprecated Use vault_get instead. This function will be removed in a future version.
Sourcepub 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
pub async fn write_bytes_to_vault( &self, data: Bytes, payment_option: PaymentOption, secret_key: &VaultSecretKey, content_type: VaultContentType, ) -> Result<AttoTokens, VaultError>
vault_put instead@deprecated Use vault_put instead. This function will be removed in a future version.
Source§impl Client
impl Client
Sourcepub fn register_history(&self, addr: &RegisterAddress) -> RegisterHistory
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
impl Client
Sourcepub fn register_key_from_name(owner: &SecretKey, name: &str) -> SecretKey
pub fn register_key_from_name(owner: &SecretKey, name: &str) -> SecretKey
Sourcepub fn register_value_from_bytes(
bytes: &[u8],
) -> Result<RegisterValue, RegisterError>
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
Sourcepub async fn register_create(
&self,
owner: &SecretKey,
initial_value: RegisterValue,
payment_option: PaymentOption,
) -> Result<(AttoTokens, RegisterAddress), RegisterError>
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
Sourcepub async fn register_update(
&self,
owner: &SecretKey,
new_value: RegisterValue,
payment_option: PaymentOption,
) -> Result<AttoTokens, RegisterError>
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
Sourcepub async fn register_get(
&self,
addr: &RegisterAddress,
) -> Result<RegisterValue, RegisterError>
pub async fn register_get( &self, addr: &RegisterAddress, ) -> Result<RegisterValue, RegisterError>
Get the current value of the register
Sourcepub async fn register_cost(
&self,
owner: &PublicKey,
) -> Result<AttoTokens, CostError>
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
impl Client
Sourcepub async fn analyze_address(
&self,
address: &str,
verbose: bool,
) -> Result<Analysis, AnalysisError>
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).
Sourcepub async fn analyze_address_recursively(
&self,
address: &str,
verbose: bool,
) -> HashMap<String, Result<Analysis, AnalysisError>>
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).
Sourcepub async fn analyze_address_type(
&self,
address: &str,
verbose: bool,
) -> Result<PointerTarget, AnalysisError>
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
impl Client
Sourcepub async fn get_raw_quotes(
&self,
data_type: DataTypes,
content_addrs: impl Iterator<Item = (XorName, usize)>,
) -> Vec<Result<(XorName, Vec<(PeerId, Addresses, PaymentQuote)>), CostError>>
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.
Sourcepub 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>
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.
pub async fn get_store_quotes( &self, data_type: DataTypes, content_addrs: impl Iterator<Item = (XorName, usize)>, ) -> Result<StoreQuote, CostError>
Source§impl Client
impl Client
Sourcepub 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.
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>
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
impl Client
Sourcepub async fn get_closest_to_address(
&self,
network_address: impl Into<NetworkAddress>,
count: Option<usize>,
) -> Result<Vec<PeerInfo>, NetworkError>
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.
Sourcepub async fn get_record_from_peer(
&self,
network_address: impl Into<NetworkAddress>,
peer: PeerInfo,
) -> Result<Option<Record>, NetworkError>
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
Sourcepub async fn get_record_and_holders(
&self,
network_address: impl Into<NetworkAddress>,
quorum: Quorum,
) -> Result<(Option<Record>, Vec<PeerId>), NetworkError>
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.
Sourcepub 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>
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
pub async fn get_node_version( &self, peer: PeerInfo, ) -> Result<PackageVersion, String>
Source§impl Client
impl Client
Sourcepub async fn init() -> Result<Self, ConnectError>
pub async fn init() -> Result<Self, ConnectError>
Initialize the client with default configuration.
Sourcepub async fn init_local() -> Result<Self, ConnectError>
pub async fn init_local() -> Result<Self, ConnectError>
Initialize a client that is configured to be local.
Sourcepub async fn init_alpha() -> Result<Self, ConnectError>
pub async fn init_alpha() -> Result<Self, ConnectError>
Initialize a client that is configured to be connected to the the alpha network (Impossible Futures).
Sourcepub async fn init_with_peers(
peers: Vec<Multiaddr>,
) -> Result<Self, ConnectError>
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?;Sourcepub async fn init_with_config(
config: ClientConfig,
) -> Result<Self, ConnectError>
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?;Sourcepub fn with_strategy(self, strategy: ClientOperatingStrategy) -> Self
pub fn with_strategy(self, strategy: ClientOperatingStrategy) -> Self
Set the ClientOperatingStrategy for the client.
Sourcepub fn with_retry_failed(self, retry_failed: u64) -> Self
pub fn with_retry_failed(self, retry_failed: u64) -> Self
Set whether to retry failed uploads automatically.
Sourcepub fn with_payment_mode(self, payment_mode: PaymentMode) -> Self
pub fn with_payment_mode(self, payment_mode: PaymentMode) -> Self
Set the payment mode for uploads.
Sourcepub fn enable_client_events(&mut self) -> Receiver<ClientEvent>
pub fn enable_client_events(&mut self) -> Receiver<ClientEvent>
Receive events from the client.
Sourcepub fn evm_network(&self) -> &EvmNetwork
pub fn evm_network(&self) -> &EvmNetwork
Get the evm network.
Trait Implementations§
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<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
Source§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> FmtForward for T
impl<T> FmtForward for T
Source§fn fmt_binary(self) -> FmtBinary<Self>where
Self: Binary,
fn fmt_binary(self) -> FmtBinary<Self>where
Self: Binary,
self to use its Binary implementation when Debug-formatted.Source§fn fmt_display(self) -> FmtDisplay<Self>where
Self: Display,
fn fmt_display(self) -> FmtDisplay<Self>where
Self: Display,
self to use its Display implementation when
Debug-formatted.Source§fn fmt_lower_exp(self) -> FmtLowerExp<Self>where
Self: LowerExp,
fn fmt_lower_exp(self) -> FmtLowerExp<Self>where
Self: LowerExp,
self to use its LowerExp implementation when
Debug-formatted.Source§fn fmt_lower_hex(self) -> FmtLowerHex<Self>where
Self: LowerHex,
fn fmt_lower_hex(self) -> FmtLowerHex<Self>where
Self: LowerHex,
self to use its LowerHex implementation when
Debug-formatted.Source§fn fmt_octal(self) -> FmtOctal<Self>where
Self: Octal,
fn fmt_octal(self) -> FmtOctal<Self>where
Self: Octal,
self to use its Octal implementation when Debug-formatted.Source§fn fmt_pointer(self) -> FmtPointer<Self>where
Self: Pointer,
fn fmt_pointer(self) -> FmtPointer<Self>where
Self: Pointer,
self to use its Pointer implementation when
Debug-formatted.Source§fn fmt_upper_exp(self) -> FmtUpperExp<Self>where
Self: UpperExp,
fn fmt_upper_exp(self) -> FmtUpperExp<Self>where
Self: UpperExp,
self to use its UpperExp implementation when
Debug-formatted.Source§fn fmt_upper_hex(self) -> FmtUpperHex<Self>where
Self: UpperHex,
fn fmt_upper_hex(self) -> FmtUpperHex<Self>where
Self: UpperHex,
self to use its UpperHex implementation when
Debug-formatted.Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
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 moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
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 moreSource§impl<D> OwoColorize for D
impl<D> OwoColorize for D
Source§fn fg<C>(&self) -> FgColorDisplay<'_, C, Self>where
C: Color,
fn fg<C>(&self) -> FgColorDisplay<'_, C, Self>where
C: Color,
Source§fn bg<C>(&self) -> BgColorDisplay<'_, C, Self>where
C: Color,
fn bg<C>(&self) -> BgColorDisplay<'_, C, Self>where
C: Color,
Source§fn black(&self) -> FgColorDisplay<'_, Black, Self>
fn black(&self) -> FgColorDisplay<'_, Black, Self>
Source§fn on_black(&self) -> BgColorDisplay<'_, Black, Self>
fn on_black(&self) -> BgColorDisplay<'_, Black, Self>
Source§fn red(&self) -> FgColorDisplay<'_, Red, Self>
fn red(&self) -> FgColorDisplay<'_, Red, Self>
Source§fn on_red(&self) -> BgColorDisplay<'_, Red, Self>
fn on_red(&self) -> BgColorDisplay<'_, Red, Self>
Source§fn green(&self) -> FgColorDisplay<'_, Green, Self>
fn green(&self) -> FgColorDisplay<'_, Green, Self>
Source§fn on_green(&self) -> BgColorDisplay<'_, Green, Self>
fn on_green(&self) -> BgColorDisplay<'_, Green, Self>
Source§fn yellow(&self) -> FgColorDisplay<'_, Yellow, Self>
fn yellow(&self) -> FgColorDisplay<'_, Yellow, Self>
Source§fn on_yellow(&self) -> BgColorDisplay<'_, Yellow, Self>
fn on_yellow(&self) -> BgColorDisplay<'_, Yellow, Self>
Source§fn blue(&self) -> FgColorDisplay<'_, Blue, Self>
fn blue(&self) -> FgColorDisplay<'_, Blue, Self>
Source§fn on_blue(&self) -> BgColorDisplay<'_, Blue, Self>
fn on_blue(&self) -> BgColorDisplay<'_, Blue, Self>
Source§fn magenta(&self) -> FgColorDisplay<'_, Magenta, Self>
fn magenta(&self) -> FgColorDisplay<'_, Magenta, Self>
Source§fn on_magenta(&self) -> BgColorDisplay<'_, Magenta, Self>
fn on_magenta(&self) -> BgColorDisplay<'_, Magenta, Self>
Source§fn purple(&self) -> FgColorDisplay<'_, Magenta, Self>
fn purple(&self) -> FgColorDisplay<'_, Magenta, Self>
Source§fn on_purple(&self) -> BgColorDisplay<'_, Magenta, Self>
fn on_purple(&self) -> BgColorDisplay<'_, Magenta, Self>
Source§fn cyan(&self) -> FgColorDisplay<'_, Cyan, Self>
fn cyan(&self) -> FgColorDisplay<'_, Cyan, Self>
Source§fn on_cyan(&self) -> BgColorDisplay<'_, Cyan, Self>
fn on_cyan(&self) -> BgColorDisplay<'_, Cyan, Self>
Source§fn white(&self) -> FgColorDisplay<'_, White, Self>
fn white(&self) -> FgColorDisplay<'_, White, Self>
Source§fn on_white(&self) -> BgColorDisplay<'_, White, Self>
fn on_white(&self) -> BgColorDisplay<'_, White, Self>
Source§fn default_color(&self) -> FgColorDisplay<'_, Default, Self>
fn default_color(&self) -> FgColorDisplay<'_, Default, Self>
Source§fn on_default_color(&self) -> BgColorDisplay<'_, Default, Self>
fn on_default_color(&self) -> BgColorDisplay<'_, Default, Self>
Source§fn bright_black(&self) -> FgColorDisplay<'_, BrightBlack, Self>
fn bright_black(&self) -> FgColorDisplay<'_, BrightBlack, Self>
Source§fn on_bright_black(&self) -> BgColorDisplay<'_, BrightBlack, Self>
fn on_bright_black(&self) -> BgColorDisplay<'_, BrightBlack, Self>
Source§fn bright_red(&self) -> FgColorDisplay<'_, BrightRed, Self>
fn bright_red(&self) -> FgColorDisplay<'_, BrightRed, Self>
Source§fn on_bright_red(&self) -> BgColorDisplay<'_, BrightRed, Self>
fn on_bright_red(&self) -> BgColorDisplay<'_, BrightRed, Self>
Source§fn bright_green(&self) -> FgColorDisplay<'_, BrightGreen, Self>
fn bright_green(&self) -> FgColorDisplay<'_, BrightGreen, Self>
Source§fn on_bright_green(&self) -> BgColorDisplay<'_, BrightGreen, Self>
fn on_bright_green(&self) -> BgColorDisplay<'_, BrightGreen, Self>
Source§fn bright_yellow(&self) -> FgColorDisplay<'_, BrightYellow, Self>
fn bright_yellow(&self) -> FgColorDisplay<'_, BrightYellow, Self>
Source§fn on_bright_yellow(&self) -> BgColorDisplay<'_, BrightYellow, Self>
fn on_bright_yellow(&self) -> BgColorDisplay<'_, BrightYellow, Self>
Source§fn bright_blue(&self) -> FgColorDisplay<'_, BrightBlue, Self>
fn bright_blue(&self) -> FgColorDisplay<'_, BrightBlue, Self>
Source§fn on_bright_blue(&self) -> BgColorDisplay<'_, BrightBlue, Self>
fn on_bright_blue(&self) -> BgColorDisplay<'_, BrightBlue, Self>
Source§fn bright_magenta(&self) -> FgColorDisplay<'_, BrightMagenta, Self>
fn bright_magenta(&self) -> FgColorDisplay<'_, BrightMagenta, Self>
Source§fn on_bright_magenta(&self) -> BgColorDisplay<'_, BrightMagenta, Self>
fn on_bright_magenta(&self) -> BgColorDisplay<'_, BrightMagenta, Self>
Source§fn bright_purple(&self) -> FgColorDisplay<'_, BrightMagenta, Self>
fn bright_purple(&self) -> FgColorDisplay<'_, BrightMagenta, Self>
Source§fn on_bright_purple(&self) -> BgColorDisplay<'_, BrightMagenta, Self>
fn on_bright_purple(&self) -> BgColorDisplay<'_, BrightMagenta, Self>
Source§fn bright_cyan(&self) -> FgColorDisplay<'_, BrightCyan, Self>
fn bright_cyan(&self) -> FgColorDisplay<'_, BrightCyan, Self>
Source§fn on_bright_cyan(&self) -> BgColorDisplay<'_, BrightCyan, Self>
fn on_bright_cyan(&self) -> BgColorDisplay<'_, BrightCyan, Self>
Source§fn bright_white(&self) -> FgColorDisplay<'_, BrightWhite, Self>
fn bright_white(&self) -> FgColorDisplay<'_, BrightWhite, Self>
Source§fn on_bright_white(&self) -> BgColorDisplay<'_, BrightWhite, Self>
fn on_bright_white(&self) -> BgColorDisplay<'_, BrightWhite, Self>
Source§fn bold(&self) -> BoldDisplay<'_, Self>
fn bold(&self) -> BoldDisplay<'_, Self>
Source§fn dimmed(&self) -> DimDisplay<'_, Self>
fn dimmed(&self) -> DimDisplay<'_, Self>
Source§fn italic(&self) -> ItalicDisplay<'_, Self>
fn italic(&self) -> ItalicDisplay<'_, Self>
Source§fn underline(&self) -> UnderlineDisplay<'_, Self>
fn underline(&self) -> UnderlineDisplay<'_, Self>
Source§fn blink(&self) -> BlinkDisplay<'_, Self>
fn blink(&self) -> BlinkDisplay<'_, Self>
Source§fn blink_fast(&self) -> BlinkFastDisplay<'_, Self>
fn blink_fast(&self) -> BlinkFastDisplay<'_, Self>
Source§fn reversed(&self) -> ReversedDisplay<'_, Self>
fn reversed(&self) -> ReversedDisplay<'_, Self>
Source§fn strikethrough(&self) -> StrikeThroughDisplay<'_, Self>
fn strikethrough(&self) -> StrikeThroughDisplay<'_, Self>
Source§fn color<Color>(&self, color: Color) -> FgDynColorDisplay<'_, Color, Self>where
Color: DynColor,
fn color<Color>(&self, color: Color) -> FgDynColorDisplay<'_, Color, Self>where
Color: DynColor,
OwoColorize::fg or
a color-specific method, such as OwoColorize::green, Read moreSource§fn on_color<Color>(&self, color: Color) -> BgDynColorDisplay<'_, Color, Self>where
Color: DynColor,
fn on_color<Color>(&self, color: Color) -> BgDynColorDisplay<'_, Color, Self>where
Color: DynColor,
OwoColorize::bg or
a color-specific method, such as OwoColorize::on_yellow, Read moreSource§fn fg_rgb<const R: u8, const G: u8, const B: u8>(
&self,
) -> FgColorDisplay<'_, CustomColor<R, G, B>, Self>
fn fg_rgb<const R: u8, const G: u8, const B: u8>( &self, ) -> FgColorDisplay<'_, CustomColor<R, G, B>, Self>
Source§fn bg_rgb<const R: u8, const G: u8, const B: u8>(
&self,
) -> BgColorDisplay<'_, CustomColor<R, G, B>, Self>
fn bg_rgb<const R: u8, const G: u8, const B: u8>( &self, ) -> BgColorDisplay<'_, CustomColor<R, G, B>, Self>
Source§fn truecolor(&self, r: u8, g: u8, b: u8) -> FgDynColorDisplay<'_, Rgb, Self>
fn truecolor(&self, r: u8, g: u8, b: u8) -> FgDynColorDisplay<'_, Rgb, Self>
Source§fn on_truecolor(&self, r: u8, g: u8, b: u8) -> BgDynColorDisplay<'_, Rgb, Self>
fn on_truecolor(&self, r: u8, g: u8, b: u8) -> BgDynColorDisplay<'_, Rgb, Self>
Source§impl<T> Pipe for Twhere
T: ?Sized,
impl<T> Pipe for Twhere
T: ?Sized,
Source§fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> Rwhere
Self: Sized,
fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> Rwhere
Self: Sized,
Source§fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> Rwhere
R: 'a,
fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> Rwhere
R: 'a,
self and passes that borrow into the pipe function. Read moreSource§fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> Rwhere
R: 'a,
fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> Rwhere
R: 'a,
self and passes that borrow into the pipe function. Read moreSource§fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> R
fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> R
Source§fn pipe_borrow_mut<'a, B, R>(
&'a mut self,
func: impl FnOnce(&'a mut B) -> R,
) -> R
fn pipe_borrow_mut<'a, B, R>( &'a mut self, func: impl FnOnce(&'a mut B) -> R, ) -> R
Source§fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> R
fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> R
self, then passes self.as_ref() into the pipe function.Source§fn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> R
fn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> R
self, then passes self.as_mut() into the pipe
function.Source§fn pipe_deref<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> R
fn pipe_deref<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> R
self, then passes self.deref() into the pipe function.Source§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
Source§impl<T> Tap for T
impl<T> Tap for T
Source§fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Self
fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Self
Borrow<B> of a value. Read moreSource§fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Self
fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Self
BorrowMut<B> of a value. Read moreSource§fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Self
fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Self
AsRef<R> view of a value. Read moreSource§fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Self
fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Self
AsMut<R> view of a value. Read moreSource§fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Self
fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Self
Deref::Target of a value. Read moreSource§fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Self
fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Self
Deref::Target of a value. Read moreSource§fn tap_dbg(self, func: impl FnOnce(&Self)) -> Self
fn tap_dbg(self, func: impl FnOnce(&Self)) -> Self
.tap() only in debug builds, and is erased in release builds.Source§fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self
fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self
.tap_mut() only in debug builds, and is erased in release
builds.Source§fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Self
fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Self
.tap_borrow() only in debug builds, and is erased in release
builds.Source§fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Self
fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Self
.tap_borrow_mut() only in debug builds, and is erased in release
builds.Source§fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Self
fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Self
.tap_ref() only in debug builds, and is erased in release
builds.Source§fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Self
fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Self
.tap_ref_mut() only in debug builds, and is erased in release
builds.Source§fn tap_deref_dbg<T>(self, func: impl FnOnce(&T)) -> Self
fn tap_deref_dbg<T>(self, func: impl FnOnce(&T)) -> Self
.tap_deref() only in debug builds, and is erased in release
builds.