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
impl Safe
sourcepub async fn files_container_create(&self) -> Result<XorUrl>
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://"))
sourcepub async fn files_container_create_from<P: AsRef<Path>>(
&self,
location: P,
dst: Option<&Path>,
recursive: bool,
follow_links: bool
) -> Result<(XorUrl, ProcessedFiles, FilesMap)>
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://"))
sourcepub async fn files_container_get(
&self,
url: &str
) -> Result<Option<(VersionHash, FilesMap)>>
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);
sourcepub 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)>
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);
}
sourcepub async fn files_container_add(
&self,
source_file: &str,
url: &str,
force: bool,
update_nrs: bool,
follow_links: bool
) -> Result<(Option<(VersionHash, FilesMap)>, ProcessedFiles)>
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);
}
sourcepub async fn files_container_add_from_raw(
&self,
data: Bytes,
url: &str,
force: bool,
update_nrs: bool
) -> Result<(Option<(VersionHash, FilesMap)>, ProcessedFiles)>
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);
}
sourcepub async fn files_container_remove_path(
&self,
url: &str,
recursive: bool,
update_nrs: bool
) -> Result<(VersionHash, ProcessedFiles, FilesMap)>
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);
sourcepub async fn store_bytes(
&self,
bytes: Bytes,
media_type: Option<&str>
) -> Result<XorUrl>
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);
sourcepub async fn files_get(&self, url: &str, range: Range) -> Result<Bytes>
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
impl Safe
sourcepub async fn validate_sk_for_url(
&self,
secret_key: &SecretKey,
url: &str
) -> Result<String>
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.
sourcepub fn new_keypair_with_pk_url(&self) -> Result<(Keypair, SafeUrl)>
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.
sourcepub fn serialize_bls_key(
secret_key: &BlsSecretKey,
path: impl AsRef<Path>
) -> Result<()>
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.
sourcepub fn deserialize_bls_key(path: impl AsRef<Path>) -> Result<BlsSecretKey>
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
impl Safe
sourcepub async fn multimap_create(
&self,
name: Option<XorName>,
type_tag: u64
) -> Result<XorUrl>
pub async fn multimap_create( &self, name: Option<XorName>, type_tag: u64 ) -> Result<XorUrl>
Create a Multimap on the network
sourcepub async fn multimap_get_by_key(
&self,
url: &str,
key: &[u8]
) -> Result<Multimap>
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
sourcepub async fn multimap_get_by_hash(
&self,
url: &str,
hash: EntryHash
) -> Result<MultimapKeyValue>
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
sourcepub async fn multimap_insert(
&self,
multimap_url: &str,
entry: MultimapKeyValue,
replace: BTreeSet<EntryHash>
) -> Result<EntryHash>
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
sourcepub async fn multimap_remove(
&self,
url: &str,
to_remove: BTreeSet<EntryHash>
) -> Result<EntryHash>
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
impl Safe
sourcepub async fn nrs_create(&self, top_name: &str) -> Result<SafeUrl>
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_associateor
nrs_add`
sourcepub async fn nrs_associate(
&self,
public_name: &str,
link: &SafeUrl
) -> Result<SafeUrl>
pub async fn nrs_associate( &self, public_name: &str, link: &SafeUrl ) -> Result<SafeUrl>
Associates a public name to a link
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}
sourcepub async fn nrs_add(
&self,
public_name: &str,
link: &SafeUrl
) -> Result<(SafeUrl, bool)>
pub async fn nrs_add( &self, public_name: &str, link: &SafeUrl ) -> Result<(SafeUrl, bool)>
Associates any public name to a link
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.
sourcepub async fn nrs_remove(&self, public_name: &str) -> Result<SafeUrl>
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}
sourcepub async fn nrs_get(
&self,
public_name: &str,
version: Option<VersionHash>
) -> Result<(Option<SafeUrl>, NrsMap)>
pub async fn nrs_get( &self, public_name: &str, version: Option<VersionHash> ) -> Result<(Option<SafeUrl>, NrsMap)>
Gets a public name’s associated link
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
sourcepub async fn nrs_get_subnames_map(
&self,
public_name: &str,
version: Option<VersionHash>
) -> Result<NrsMap>
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
impl Safe
sourcepub async fn register_create(
&self,
name: Option<XorName>,
tag: u64,
content_type: ContentType
) -> Result<XorUrl>
pub async fn register_create( &self, name: Option<XorName>, tag: u64, content_type: ContentType ) -> Result<XorUrl>
Create a Register on the network
sourcepub async fn register_read(
&self,
url: &str
) -> Result<BTreeSet<(EntryHash, Entry)>>
pub async fn register_read( &self, url: &str ) -> Result<BTreeSet<(EntryHash, Entry)>>
Read value from a Register on the network
source§impl Safe
impl Safe
sourcepub async fn parse_and_resolve_url(&self, url: &str) -> Result<SafeUrl>
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
sourcepub async fn fetch(&self, url: &str, range: Range) -> Result<SafeData>
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!"));
sourcepub async fn inspect(&self, url: &str) -> Result<Vec<SafeData>>
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
)
};
sourcepub async fn check_replicas(
&self,
url: &str,
replicas: &[usize]
) -> Result<Vec<QueriedDataReplicas>>
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
impl Safe
sourcepub async fn wallet_create(&self) -> Result<XorUrl>
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.
sourcepub async fn wallet_deposit(
&self,
wallet_url: &str,
spendable_name: Option<&str>,
dbc: &Dbc,
secret_key: Option<SecretKey>
) -> Result<(String, Token)>
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.
sourcepub async fn is_dbc_spent(&self, public_key: PublicKey) -> Result<bool>
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.
sourcepub async fn wallet_get(&self, wallet_url: &str) -> Result<WalletSpendableDbcs>
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.
sourcepub async fn wallet_balance(&self, wallet_url: &str) -> Result<Token>
pub async fn wallet_balance(&self, wallet_url: &str) -> Result<Token>
Check the total balance of a wallet found at a given XOR-URL
sourcepub async fn wallet_reissue(
&self,
wallet_url: &str,
amount: &str,
owner_public_key: Option<PublicKey>,
reason: DbcReason
) -> Result<Dbc>
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.
sourcepub async fn wallet_reissue_many(
&self,
wallet_url: &str,
outputs: Vec<(String, Option<PublicKey>)>,
reason: DbcReason
) -> Result<Vec<Dbc>>
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
impl Safe
sourcepub async fn auth_app(
app_id: &str,
app_name: &str,
app_vendor: &str,
endpoint: Option<&str>,
authd_cert_path: impl AsRef<Path>
) -> Result<Keypair>
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
impl Safe
sourcepub fn dry_runner(xorurl_base: Option<XorUrlBase>) -> Self
pub fn dry_runner(xorurl_base: Option<XorUrlBase>) -> Self
Create a Safe instance without connecting to the SAFE Network
sourcepub async fn connected(
keypair: Option<Keypair>,
xorurl_base: Option<XorUrlBase>,
timeout: Option<Duration>,
dbc_owner: Option<Owner>
) -> Result<Self>
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
sourcepub async fn connect(
&mut self,
keypair: Option<Keypair>,
timeout: Option<Duration>,
dbc_owner: Option<Owner>
) -> Result<()>
pub async fn connect( &mut self, keypair: Option<Keypair>, timeout: Option<Duration>, dbc_owner: Option<Owner> ) -> Result<()>
Connect to the SAFE Network
sourcepub fn is_connected(&self) -> bool
pub fn is_connected(&self) -> bool
Returns true if we already have a connection with the network
sourcepub async fn section_tree(&self) -> Result<SectionTree>
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§
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§
§impl<T> Conv for T
impl<T> Conv for T
§impl<T> FmtForward for T
impl<T> FmtForward for T
§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.§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.§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.§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.§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.§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.§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.§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.§fn fmt_list(self) -> FmtList<Self>where
&'a Self: for<'a> IntoIterator,
fn fmt_list(self) -> FmtList<Self>where &'a Self: for<'a> IntoIterator,
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>
§impl<T> Pipe for Twhere
T: ?Sized,
impl<T> Pipe for Twhere T: ?Sized,
§fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> Rwhere
Self: Sized,
fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> Rwhere Self: Sized,
§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 more§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 more§fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> Rwhere
Self: Borrow<B>,
B: 'a + ?Sized,
R: 'a,
fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> Rwhere Self: Borrow<B>, B: 'a + ?Sized, R: 'a,
§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,
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,
§fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> Rwhere
Self: AsRef<U>,
U: 'a + ?Sized,
R: 'a,
fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> Rwhere Self: AsRef<U>, U: 'a + ?Sized, R: 'a,
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,
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,
self
, then passes self.as_mut()
into the pipe
function.§impl<T> Pointable for T
impl<T> Pointable for T
§impl<T> Tap for T
impl<T> Tap for T
§fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Selfwhere
Self: Borrow<B>,
B: ?Sized,
fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Selfwhere Self: Borrow<B>, B: ?Sized,
Borrow<B>
of a value. Read more§fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Selfwhere
Self: BorrowMut<B>,
B: ?Sized,
fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Selfwhere Self: BorrowMut<B>, B: ?Sized,
BorrowMut<B>
of a value. Read more§fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Selfwhere
Self: AsRef<R>,
R: ?Sized,
fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Selfwhere Self: AsRef<R>, R: ?Sized,
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,
fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Selfwhere Self: AsMut<R>, R: ?Sized,
AsMut<R>
view of a value. Read more§fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Selfwhere
Self: Deref<Target = T>,
T: ?Sized,
fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Selfwhere Self: Deref<Target = T>, T: ?Sized,
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,
fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Selfwhere Self: DerefMut<Target = T> + Deref, T: ?Sized,
Deref::Target
of a value. Read more§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.§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.§fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Selfwhere
Self: Borrow<B>,
B: ?Sized,
fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Selfwhere Self: Borrow<B>, B: ?Sized,
.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,
fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Selfwhere Self: BorrowMut<B>, B: ?Sized,
.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,
fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Selfwhere Self: AsRef<R>, R: ?Sized,
.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,
fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Selfwhere Self: AsMut<R>, R: ?Sized,
.tap_ref_mut()
only in debug builds, and is erased in release
builds.