Struct sn_api::Safe

source ·
pub struct Safe {
    pub xorurl_base: XorUrlBase,
    pub dry_run_mode: bool,
    /* private fields */
}

Fields§

§xorurl_base: XorUrlBase§dry_run_mode: bool

Implementations§

source§

impl Safe

source

pub async fn files_container_create(&self) -> Result<XorUrl>

Create an empty FilesContainer.
Example
    let mut safe = Safe::connected(None, None, None, None).await.unwrap();
    let xorurl = safe.files_container_create().await.unwrap();
    assert!(xorurl.contains("safe://"))
source

pub async fn files_container_create_from<P: AsRef<Path>>( &self, location: P, dst: Option<&Path>, recursive: bool, follow_links: bool ) -> Result<(XorUrl, ProcessedFiles, FilesMap)>

Create a FilesContainer containing files uploaded from a local folder.
Example
    let mut safe = Safe::connected(None, None, None, None).await.unwrap();
    let (xorurl, _processed_files, _files_map) = safe.files_container_create_from("./testdata", None, true, true).await.unwrap();
    assert!(xorurl.contains("safe://"))
source

pub async fn files_container_get( &self, url: &str ) -> Result<Option<(VersionHash, FilesMap)>>

Fetch an existing FilesContainer.
Example
    let (xorurl, _processed_files, _files_map) = safe.files_container_create_from("./testdata", None, true, true).await.unwrap();
    let (version, files_map) = safe.files_container_get(&xorurl).await.unwrap().unwrap();
    println!("FilesContainer fetched is at version: {}", version);
    println!("FilesMap of fetched version is: {:?}", files_map);
source

pub async fn files_container_sync<P: AsRef<Path>>( &self, location: P, url: &str, recursive: bool, follow_links: bool, delete: bool, update_nrs: bool ) -> Result<(Option<(VersionHash, FilesMap)>, ProcessedFiles)>

Sync up local folder with the content on a FilesContainer.
Example
    let (xorurl, _processed_files, _files_map) = safe.files_container_create_from("./testdata", None, true, false).await.unwrap();
    let (optional_version_map, new_processed_files) = safe.files_container_sync("./testdata", &xorurl, true, true, false, false).await.unwrap();
    if let Some((version, new_files_map)) = optional_version_map {
        println!("FilesContainer is now at version: {}", version);
        println!("The local files that were synced up are: {:?}", new_processed_files);
        println!("The FilesMap of the updated FilesContainer now is: {:?}", new_files_map);
    }
source

pub async fn files_container_add( &self, source_file: &str, url: &str, force: bool, update_nrs: bool, follow_links: bool ) -> Result<(Option<(VersionHash, FilesMap)>, ProcessedFiles)>

Add a file, either a local path or an already uploaded file, on an existing FilesContainer.
Example
    let (xorurl, _processed_files, _files_map) = safe.files_container_create_from("./testdata", None, true, true).await.unwrap();
    let new_file_name = format!("{}/new_name_test.md", xorurl);
    let (optional_version_map, new_processed_files) = safe.files_container_add("./testdata/test.md", &new_file_name, false, false, true).await.unwrap();
    if let Some((version, new_files_map)) = optional_version_map {
        println!("FilesContainer is now at version: {}", version);
        println!("The local files that were synced up are: {:?}", new_processed_files);
        println!("The FilesMap of the updated FilesContainer now is: {:?}", new_files_map);
    }
source

pub async fn files_container_add_from_raw( &self, data: Bytes, url: &str, force: bool, update_nrs: bool ) -> Result<(Option<(VersionHash, FilesMap)>, ProcessedFiles)>

Add a file, from raw bytes, on an existing FilesContainer.
Example
    let (xorurl, _processed_files, _files_map) = safe.files_container_create_from("./testdata", None, true, true).await.unwrap();
    let new_file_name = format!("{}/new_name_test.md", xorurl);
    let (optional_version_map, new_processed_files) = safe.files_container_add_from_raw(Bytes::from("0123456789"), &new_file_name, false, false).await.unwrap();
    if let Some((version, new_files_map)) = optional_version_map {
        println!("FilesContainer is now at version: {}", version);
        println!("The local files that were synced up are: {:?}", new_processed_files);
        println!("The FilesMap of the updated FilesContainer now is: {:?}", new_files_map);
    }
source

pub async fn files_container_remove_path( &self, url: &str, recursive: bool, update_nrs: bool ) -> Result<(VersionHash, ProcessedFiles, FilesMap)>

Remove a file from an existing FilesContainer.
Example
    let (xorurl, processed_files, files_map) = safe.files_container_create_from("./testdata/", None, true, true).await.unwrap();
    let remote_file_path = format!("{}/test.md", xorurl);
    let (version, new_processed_files, new_files_map) = safe.files_container_remove_path(&remote_file_path, false, false).await.unwrap();
    println!("FilesContainer is now at version: {}", version);
    println!("The files that were removed: {:?}", new_processed_files);
    println!("The FilesMap of the updated FilesContainer now is: {:?}", new_files_map);
source

pub async fn store_bytes( &self, bytes: Bytes, media_type: Option<&str> ) -> Result<XorUrl>

Store a file

Store files onto the network. The data will be saved as one or more chunks, depending on the size of the data. If it’s less than 3072 bytes, it’ll be stored in a single chunk, otherwise, it’ll be stored in multiple chunks.

Example
    let data = Bytes::from("Something super good");
    let xorurl = safe.store_bytes(data.clone(), Some("text/plain")).await.unwrap();
    let received_data = safe.files_get(&xorurl, None).await.unwrap();
    assert_eq!(received_data, data);
source

pub async fn files_get(&self, url: &str, range: Range) -> Result<Bytes>

Get a file

Get file from the network.

Example
    let data = Bytes::from("Something super good");
    let xorurl = safe.store_bytes(data.clone(), None).await.unwrap();
    let received_data = safe.files_get(&xorurl, None).await.unwrap();
    assert_eq!(received_data, data);
source§

impl Safe

source

pub async fn validate_sk_for_url( &self, secret_key: &SecretKey, url: &str ) -> Result<String>

Check the XOR/NRS-URL corresponds to the public key derived from the provided client id.

source

pub fn new_keypair_with_pk_url(&self) -> Result<(Keypair, SafeUrl)>

Generate a new random BLS keypair along with a URL for the public key.

source

pub fn serialize_bls_key( secret_key: &BlsSecretKey, path: impl AsRef<Path> ) -> Result<()>

Serializes a SecretKey to hex in a file at a given path.

If the path already exists it will be overwritten.

source

pub fn deserialize_bls_key(path: impl AsRef<Path>) -> Result<BlsSecretKey>

Deserializes a Keypair from file at a given path.

A utility to help callers working with keypairs avoid using serde or bincode directly.

source§

impl Safe

source

pub async fn multimap_create( &self, name: Option<XorName>, type_tag: u64 ) -> Result<XorUrl>

Create a Multimap on the network

source

pub async fn multimap_get_by_key( &self, url: &str, key: &[u8] ) -> Result<Multimap>

Return the value of a Multimap on the network corresponding to the key provided

source

pub async fn multimap_get_by_hash( &self, url: &str, hash: EntryHash ) -> Result<MultimapKeyValue>

Return the value of a Multimap on the network corresponding to the hash provided

source

pub async fn multimap_insert( &self, multimap_url: &str, entry: MultimapKeyValue, replace: BTreeSet<EntryHash> ) -> Result<EntryHash>

Insert a key-value pair into a Multimap on the network

source

pub async fn multimap_remove( &self, url: &str, to_remove: BTreeSet<EntryHash> ) -> Result<EntryHash>

Remove entries from a Multimap on the network This tombstones the removed entries, effectively hiding them if they where the latest Note that they are still stored on the network as history is kept, and you can still access them with their EntryHash

source§

impl Safe

source

pub async fn nrs_create(&self, top_name: &str) -> Result<SafeUrl>

Creates a nrs_map_container for a chosen top name
safe://<subName>.<topName>/path/to/whatever?var=value
       |-----------------|
           Public Name

Registers the given NRS top name on the network. Returns the NRS SafeUrl: safe://{top_name} Note that this NRS SafeUrl is not linked to anything yet. You just registered the topname here. You can now associate public_names (with that topname) to links using nrs_associateornrs_add`

source

pub async fn nrs_associate( &self, public_name: &str, link: &SafeUrl ) -> Result<SafeUrl>

The top name of the input public name needs to be registered first with nrs_create

safe://<subName>.<topName>/path/to/whatever?var=value
       |-----------------|
           Public Name

Associates the given public_name to the link. Errors out if the topname is not registered. Returns the versioned NRS SafeUrl (containing a VersionHash) now pointing to the provided link: safe://{public_name}?v={version_hash}

source

pub async fn nrs_add( &self, public_name: &str, link: &SafeUrl ) -> Result<(SafeUrl, bool)>

Associates the given public_name to the link registering the topname on the way if needed. Returns the versioned NRS SafeUrl (containing a VersionHash) now pointing to the provided link: safe://{public_name}?v={version_hash} Also returns a bool to indicate whether it registered the topname in the process or not.

source

pub async fn nrs_remove(&self, public_name: &str) -> Result<SafeUrl>

Removes a public name

The top name of the input public name needs to be registered first with nrs_create

safe://<subName>.<topName>/path/to/whatever?var=value
       |-----------------|
           Public Name

Removes the given public_name from the NrsMap registered for the public name’s top name on the network. Returns a versioned NRS SafeUrl (containing a VersionHash) pointing to the latest version (including the deletion) for the provided public name. safe://{public_name}?v={version_hash}

source

pub async fn nrs_get( &self, public_name: &str, version: Option<VersionHash> ) -> Result<(Option<SafeUrl>, NrsMap)>

If no version is specified, returns the latest. The top name of the input public name needs to be registered first with nrs_create

safe://<subName>.<topName>/path/to/whatever?var=value
       |-----------------|
           Public Name

Finds the SafeUrl associated with the given public name on the network. If multiple entries are found for the same public name, there’s a conflict. If there are conflicts for subnames other than the one requested, get proceeds as usual, but the NrsMap returned will ignore those conflicts. Otherwise, it returns an error. Returns the associated SafeUrl for the given public name for that version along with an NrsMap

source

pub async fn nrs_get_subnames_map( &self, public_name: &str, version: Option<VersionHash> ) -> Result<NrsMap>

Get the mapping of all subNames and their associated SafeUrl for the Nrs Map Container at the given public name

source§

impl Safe

source

pub async fn register_create( &self, name: Option<XorName>, tag: u64, content_type: ContentType ) -> Result<XorUrl>

Create a Register on the network

source

pub async fn register_read( &self, url: &str ) -> Result<BTreeSet<(EntryHash, Entry)>>

Read value from a Register on the network

source

pub async fn register_read_entry( &self, url: &str, hash: EntryHash ) -> Result<Entry>

Read value from a Register on the network by its hash

source

pub async fn register_write( &self, url: &str, entry: Entry, parents: BTreeSet<EntryHash> ) -> Result<EntryHash>

Write value to a Register on the network

source§

impl Safe

source

pub async fn parse_and_resolve_url(&self, url: &str) -> Result<SafeUrl>

Parses a string URL “safe://url” and returns a safe URL Resolves until it reaches the final URL

source

pub async fn fetch(&self, url: &str, range: Range) -> Result<SafeData>

Retrieve data from a safe:// URL
Examples
Fetch FilesContainer relative path file
    let (xorurl, _, _) = safe.files_container_create_from("./testdata/", None, true, false).await.unwrap();

    let safe_data = safe.fetch( &format!( "{}/test.md", &xorurl.replace("?v=0", "") ), None ).await.unwrap();
    let data_string = match safe_data {
        SafeData::PublicFile { data, .. } => {
            match String::from_utf8(data.to_vec()) {
                Ok(string) => string,
                Err(e) => panic!("Invalid UTF-8 sequence: {}", e),
            }
        }
        other => panic!(
            "Content type '{:?}' should not have been found. This should be immutable data.",
            other
        )
    };

    assert!(data_string.starts_with("hello tests!"));
source

pub async fn inspect(&self, url: &str) -> Result<Vec<SafeData>>

Inspect a safe:// URL and retrieve metadata information but the actual target content
As opposed to ‘fetch’ function, the actual target content won’t be fetched, and only
the URL will be inspected resolving it as necessary to find the target location.
This is helpful if you are interested in knowing about the target content,
and/or each of the SafeUrl resolution steps taken to the target content, rather than
trying to revieve the actual content.
Examples
Inspect FilesContainer relative path file
    let (container_xorurl, _, _) = safe.files_container_create_from("./testdata/", None, true, false).await.unwrap();

    let inspected_content = safe.inspect( &format!( "{}/test.md", &container_xorurl.replace("?v=0", "") ) ).await.unwrap();
    match &inspected_content[0] {
        SafeData::FilesContainer { xorurl, .. } => {
            assert_eq!(*xorurl, container_xorurl);
        }
        other => panic!(
            "Content type '{:?}' should not have been found. This should be a Files Container.",
            other
        )
    };
    match &inspected_content[1] {
        SafeData::PublicFile { data, media_type, .. } => {
            assert_eq!(*media_type, Some("text/markdown".to_string()));
            assert!(data.is_empty());
        }
        other => panic!(
            "Content type '{:?}' should not have been found. This should be an Immutable Data.",
            other
        )
    };
source

pub async fn check_replicas( &self, url: &str, replicas: &[usize] ) -> Result<Vec<QueriedDataReplicas>>

Resolve the provided Url, and try to query each of the data replicas matching the given indexes, returning the list of query results obtained from each replica. Currently only Urls resolving to a File are supported.

source§

impl Safe

source

pub async fn wallet_create(&self) -> Result<XorUrl>

Create an empty wallet and return its XOR-URL.

A wallet is stored on a private register.

source

pub async fn wallet_deposit( &self, wallet_url: &str, spendable_name: Option<&str>, dbc: &Dbc, secret_key: Option<SecretKey> ) -> Result<(String, Token)>

Deposit a DBC in a wallet to make it a spendable balance.

A name can optionally be specified for the deposit. If it isn’t, part of the hash of the DBC content will be used. Note this won’t perform a verification on the network to check if the the DBC has been already spent, the user can call to is_dbc_spent API for that purpose beforehand.

Returns the name that was set, along with the deposited amount.

source

pub async fn is_dbc_spent(&self, public_key: PublicKey) -> Result<bool>

Verify if the provided DBC’s public_key has been already spent on the network.

source

pub async fn wallet_get(&self, wallet_url: &str) -> Result<WalletSpendableDbcs>

Fetch a wallet from a Url performing all type of URL resolution required. Return the set of spendable DBCs found in the wallet.

source

pub async fn wallet_balance(&self, wallet_url: &str) -> Result<Token>

Check the total balance of a wallet found at a given XOR-URL

source

pub async fn wallet_reissue( &self, wallet_url: &str, amount: &str, owner_public_key: Option<PublicKey>, reason: DbcReason ) -> Result<Dbc>

Reissue a DBC from a wallet and return the output DBC.

If you pass None for the owner_public_key argument, the output DBC will be a bearer. If the public key is specified, the output DBC will be owned by the person in possession of the secret key corresponding to the public key.

If there is change from the transaction, the change DBC will be deposited in the source wallet.

Spent DBCs are marked as removed from the source wallet, but since all entries are kept in the history, they can still be retrieved if desired by the user.

source

pub async fn wallet_reissue_many( &self, wallet_url: &str, outputs: Vec<(String, Option<PublicKey>)>, reason: DbcReason ) -> Result<Vec<Dbc>>

Reissue several DBCs from a wallet.

This works exactly the same as wallet_reissue API with the only difference that this function allows to reissue from a single wallet several output DBCs instead of a single one. If there is change from the transaction, the change DBC will be deposited in the source wallet.

source§

impl Safe

source

pub async fn auth_app( app_id: &str, app_name: &str, app_vendor: &str, endpoint: Option<&str>, authd_cert_path: impl AsRef<Path> ) -> Result<Keypair>

Generate an authorisation request string and send it to a SAFE Authenticator. It returns the credentials necessary to connect to the network, encoded in a single string.

source§

impl Safe

source

pub fn dry_runner(xorurl_base: Option<XorUrlBase>) -> Self

Create a Safe instance without connecting to the SAFE Network

source

pub async fn connected( keypair: Option<Keypair>, xorurl_base: Option<XorUrlBase>, timeout: Option<Duration>, dbc_owner: Option<Owner> ) -> Result<Self>

Create a Safe instance connected to the SAFE Network

source

pub async fn connect( &mut self, keypair: Option<Keypair>, timeout: Option<Duration>, dbc_owner: Option<Owner> ) -> Result<()>

Connect to the SAFE Network

source

pub fn is_connected(&self) -> bool

Returns true if we already have a connection with the network

source

pub async fn section_tree(&self) -> Result<SectionTree>

SectionTree used to bootstrap on the network.

This is updated by as Anti-Entropy/update messages are received from the network. Any user of this API is responsible for caching it so it can use it for any new Safe instance, preventing it from learning all this information from the network all over again.

Trait Implementations§

source§

impl Clone for Safe

source§

fn clone(&self) -> Safe

Returns a copy of the value. Read more
1.0.0 · source§

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

Performs copy-assignment from source. Read more

Auto Trait Implementations§

§

impl !RefUnwindSafe for Safe

§

impl Send for Safe

§

impl Sync for Safe

§

impl Unpin for Safe

§

impl !UnwindSafe for Safe

Blanket Implementations§

source§

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

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

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

const: unstable · source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

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

const: unstable · source§

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

Mutably borrows from an owned value. Read more
§

impl<T> Conv for T

§

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

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

impl<T> FmtForward for T

§

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Formats each item in a sequence. Read more
source§

impl<T> From<T> for T

const: unstable · 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 Twhere U: From<T>,

const: unstable · 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.

§

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

§

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

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

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

Borrows self and passes that borrow into the pipe function. Read more
§

fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> Rwhere R: 'a,

Mutably borrows self and passes that borrow into the pipe function. Read more
§

fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> Rwhere Self: Borrow<B>, B: 'a + ?Sized, R: 'a,

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

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

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

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

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

fn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> Rwhere Self: AsMut<U>, U: 'a + ?Sized, R: 'a,

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

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

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

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

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

impl<T> Pointable for T

§

const ALIGN: usize = mem::align_of::<T>()

The alignment of pointer.
§

type Init = T

The type for initializers.
§

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

Initializes a with the given initializer. Read more
§

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

Dereferences the given pointer. Read more
§

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

Mutably dereferences the given pointer. Read more
§

unsafe fn drop(ptr: usize)

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

impl<T> Same<T> for T

§

type Output = T

Should always be Self
§

impl<T> Tap for T

§

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

Immutable access to a value. Read more
§

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

Mutable access to a value. Read more
§

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

fn tap_deref_mut_dbg<T>(self, func: impl FnOnce(&mut T)) -> Selfwhere 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 Twhere T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

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

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

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

impl<T> TryConv for T

§

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

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

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

§

type Error = Infallible

The type returned in the event of a conversion error.
const: unstable · source§

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

Performs the conversion.
source§

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

§

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

The type returned in the event of a conversion error.
const: unstable · source§

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

Performs the conversion.
§

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

§

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