Struct Client
pub struct Client {
connector: Connector,
session: Arc<Mutex<Option<Session>>>,
credentials: Option<Credentials>,
}Expand description
YubiHSM client: main API in this crate for accessing functions of the HSM hardware device.
Fields§
§connector: Connector§session: Arc<Mutex<Option<Session>>>§credentials: Option<Credentials>Implementations§
§impl Client
impl Client
pub fn open(
connector: Connector,
credentials: Credentials,
reconnect: bool,
) -> Result<Client, Error<ErrorKind>>
pub fn open( connector: Connector, credentials: Credentials, reconnect: bool, ) -> Result<Client, Error<ErrorKind>>
Open a connection via a Connector to a YubiHSM, returning a Client.
Connector may use Http, Usb, or MockHsm.
§Examples
#[cfg(all(feature = "mockhsm", feature = "passwords"))]
use yubihsm2::{
Client,
Connector,
Credentials,
authentication::{DEFAULT_AUTHENTICATION_KEY_ID, Key, key::DEFAULT_PASSWORD},
};
let credentials = Credentials {
authentication_key_id: DEFAULT_AUTHENTICATION_KEY_ID,
authentication_key: Key::derive_from_password(DEFAULT_PASSWORD),
};
let client = Client::open(Connector::mockhsm(), credentials, false)?;pub fn create(
connector: Connector,
credentials: Credentials,
) -> Result<Client, Error<ErrorKind>>
pub fn create( connector: Connector, credentials: Credentials, ) -> Result<Client, Error<ErrorKind>>
pub fn connect(&self) -> Result<(), Error<ErrorKind>>
pub fn connect(&self) -> Result<(), Error<ErrorKind>>
Connect to the HSM (idempotently, i.e. returns success if we have an open connection already)
pub fn close_session(&self) -> Result<(), Error<ErrorKind>>
pub fn close_session(&self) -> Result<(), Error<ErrorKind>>
Closes the current [Session] if it is still open.
§Errors
Returns an error, if the session lock cannot be acquired or the session cannot be closed.
pub fn session(&self) -> Result<Guard<'_>, Error<ErrorKind>>
pub fn session(&self) -> Result<Guard<'_>, Error<ErrorKind>>
Get current [Session] (either opening a new one or returning an already
open one).
pub fn ping(&self) -> Result<Duration, Error<ErrorKind>>
pub fn ping(&self) -> Result<Duration, Error<ErrorKind>>
Ping the HSM, ensuring we have a live connection and returning the end-to-end latency.
pub fn blink_device(&self, num_seconds: u8) -> Result<(), Error<ErrorKind>>
pub fn blink_device(&self, num_seconds: u8) -> Result<(), Error<ErrorKind>>
Blink the HSM’s LEDs (to identify it) for the given number of seconds.
pub fn decrypt_oaep<T>(
&self,
key_id: u16,
mgf1_hash_alg: Algorithm,
data: T,
label_hash: Vec<u8>,
) -> Result<DecryptedData, Error<ErrorKind>>
pub fn decrypt_oaep<T>( &self, key_id: u16, mgf1_hash_alg: Algorithm, data: T, label_hash: Vec<u8>, ) -> Result<DecryptedData, Error<ErrorKind>>
Decrypt data encrypted with RSA-OAEP
pub fn delete_object(
&self,
object_id: u16,
object_type: Type,
) -> Result<(), Error<ErrorKind>>
pub fn delete_object( &self, object_id: u16, object_type: Type, ) -> Result<(), Error<ErrorKind>>
Delete an object of the given ID and type.
pub fn device_info(&self) -> Result<Info, Error<ErrorKind>>
pub fn device_info(&self) -> Result<Info, Error<ErrorKind>>
Get information about the HSM device.
pub fn echo<M>(&self, msg: M) -> Result<Vec<u8>, Error<ErrorKind>>
pub fn echo<M>(&self, msg: M) -> Result<Vec<u8>, Error<ErrorKind>>
Echo a message sent to the HSM.
https://docs.yubico.com/hardware/yubihsm-2/hsm-2-user-guide/hsm2-cmd-reference.html#echo-command
pub fn export_wrapped(
&self,
wrap_key_id: u16,
object_type: Type,
object_id: u16,
) -> Result<Message, Error<ErrorKind>>
pub fn export_wrapped( &self, wrap_key_id: u16, object_type: Type, object_id: u16, ) -> Result<Message, Error<ErrorKind>>
Export an encrypted object from the HSM using the given key-wrapping key.
pub fn export_wrapped_with_seed(
&self,
wrap_key_id: u16,
object_type: Type,
object_id: u16,
) -> Result<Message, Error<ErrorKind>>
pub fn export_wrapped_with_seed( &self, wrap_key_id: u16, object_type: Type, object_id: u16, ) -> Result<Message, Error<ErrorKind>>
Export an encrypted object from the HSM using the given key-wrapping key including the private key seed.
For YubiHSM devices with firmware version 2.4 or later, this command enables exporting ed25519 keys with the seed for a private key. To ensure backward compatibility with older versions of the HSM, the default is to not export the seed. Importing such a legacy format results in an all-zero seed if such a key is exported in the future.
https://developers.yubico.com/YubiHSM2/Commands/Export_Wrapped.html
pub fn generate_asymmetric_key(
&self,
key_id: u16,
label: Label,
domains: Domain,
capabilities: Capability,
algorithm: Algorithm,
) -> Result<u16, Error<ErrorKind>>
pub fn generate_asymmetric_key( &self, key_id: u16, label: Label, domains: Domain, capabilities: Capability, algorithm: Algorithm, ) -> Result<u16, Error<ErrorKind>>
Generate a new asymmetric key within the HSM.
pub fn generate_hmac_key(
&self,
key_id: u16,
label: Label,
domains: Domain,
capabilities: Capability,
algorithm: Algorithm,
) -> Result<u16, Error<ErrorKind>>
pub fn generate_hmac_key( &self, key_id: u16, label: Label, domains: Domain, capabilities: Capability, algorithm: Algorithm, ) -> Result<u16, Error<ErrorKind>>
Generate a new HMAC key within the HSM.
pub fn generate_symmetric_key(
&self,
key_id: u16,
label: Label,
domains: Domain,
capabilities: Capability,
algorithm: Algorithm,
) -> Result<u16, Error<ErrorKind>>
pub fn generate_symmetric_key( &self, key_id: u16, label: Label, domains: Domain, capabilities: Capability, algorithm: Algorithm, ) -> Result<u16, Error<ErrorKind>>
Generate a new symmetric key within the HSM.
pub fn generate_wrap_key(
&self,
key_id: u16,
label: Label,
domains: Domain,
capabilities: Capability,
delegated_capabilities: Capability,
algorithm: Algorithm,
) -> Result<u16, Error<ErrorKind>>
pub fn generate_wrap_key( &self, key_id: u16, label: Label, domains: Domain, capabilities: Capability, delegated_capabilities: Capability, algorithm: Algorithm, ) -> Result<u16, Error<ErrorKind>>
Generate a new wrap key within the HSM.
Delegated capabilities are the set of Capability bits that an object is allowed to have
when imported or exported using the wrap key.
pub fn get_log_entries(&self) -> Result<LogEntries, Error<ErrorKind>>
pub fn get_log_entries(&self) -> Result<LogEntries, Error<ErrorKind>>
Get audit logs from the HSM device.
pub fn get_object_info(
&self,
object_id: u16,
object_type: Type,
) -> Result<Info, Error<ErrorKind>>
pub fn get_object_info( &self, object_id: u16, object_type: Type, ) -> Result<Info, Error<ErrorKind>>
Get information about an object.
pub fn get_opaque(&self, object_id: u16) -> Result<Vec<u8>, Error<ErrorKind>>
pub fn get_opaque(&self, object_id: u16) -> Result<Vec<u8>, Error<ErrorKind>>
Get an opaque object stored in the HSM.
pub fn get_command_audit_option(
&self,
command: Code,
) -> Result<AuditOption, Error<ErrorKind>>
pub fn get_command_audit_option( &self, command: Code, ) -> Result<AuditOption, Error<ErrorKind>>
Get the audit policy setting for a particular command.
pub fn get_commands_audit_options(
&self,
) -> Result<Vec<AuditCommand>, Error<ErrorKind>>
pub fn get_commands_audit_options( &self, ) -> Result<Vec<AuditCommand>, Error<ErrorKind>>
Get the audit policy settings for all commands.
pub fn get_force_audit_option(&self) -> Result<AuditOption, Error<ErrorKind>>
pub fn get_force_audit_option(&self) -> Result<AuditOption, Error<ErrorKind>>
Get the forced auditing global option: when enabled, the device will refuse operations if the log store becomes full.
pub fn get_fips_option(&self) -> Result<AuditOption, Error<ErrorKind>>
pub fn get_fips_option(&self) -> Result<AuditOption, Error<ErrorKind>>
Get the FIPS operation global option
pub fn get_pseudo_random(
&self,
bytes: usize,
) -> Result<Vec<u8>, Error<ErrorKind>>
pub fn get_pseudo_random( &self, bytes: usize, ) -> Result<Vec<u8>, Error<ErrorKind>>
Get some number of bytes of pseudo random data generated on the device.
pub fn get_public_key(&self, key_id: u16) -> Result<PublicKey, Error<ErrorKind>>
pub fn get_public_key(&self, key_id: u16) -> Result<PublicKey, Error<ErrorKind>>
Get the public key for an asymmetric key stored on the device.
pub fn get_storage_info(&self) -> Result<Info, Error<ErrorKind>>
pub fn get_storage_info(&self) -> Result<Info, Error<ErrorKind>>
Get storage info (i.e. currently free storage) from the HSM device.
pub fn get_template(&self, object_id: u16) -> Result<Vec<u8>, Error<ErrorKind>>
pub fn get_template(&self, object_id: u16) -> Result<Vec<u8>, Error<ErrorKind>>
Get a certificate template (i.e. for SSH CA) stored in the HSM.
pub fn import_wrapped<M>(
&self,
wrap_key_id: u16,
wrap_message: M,
) -> Result<Handle, Error<ErrorKind>>where
M: Into<Message>,
pub fn import_wrapped<M>(
&self,
wrap_key_id: u16,
wrap_message: M,
) -> Result<Handle, Error<ErrorKind>>where
M: Into<Message>,
Import an encrypted object from the HSM using the given key-wrapping key.
pub fn list_objects(
&self,
filters: &[Filter],
) -> Result<Vec<Entry>, Error<ErrorKind>>
pub fn list_objects( &self, filters: &[Filter], ) -> Result<Vec<Entry>, Error<ErrorKind>>
List objects visible from the current session.
Optionally apply a set of provided filters which select objects
based on their attributes.
pub fn put_asymmetric_key<K>(
&self,
key_id: u16,
label: Label,
domains: Domain,
capabilities: Capability,
algorithm: Algorithm,
key_bytes: K,
) -> Result<u16, Error<ErrorKind>>
pub fn put_asymmetric_key<K>( &self, key_id: u16, label: Label, domains: Domain, capabilities: Capability, algorithm: Algorithm, key_bytes: K, ) -> Result<u16, Error<ErrorKind>>
Put an existing asymmetric key into the HSM.
pub fn put_authentication_key<K>(
&self,
key_id: u16,
label: Label,
domains: Domain,
capabilities: Capability,
delegated_capabilities: Capability,
algorithm: Algorithm,
authentication_key: K,
) -> Result<u16, Error<ErrorKind>>where
K: Into<Key>,
pub fn put_authentication_key<K>(
&self,
key_id: u16,
label: Label,
domains: Domain,
capabilities: Capability,
delegated_capabilities: Capability,
algorithm: Algorithm,
authentication_key: K,
) -> Result<u16, Error<ErrorKind>>where
K: Into<Key>,
Put an existing [authentication::Key] into the HSM.
pub fn change_authentication_key<K>(
&self,
key_id: u16,
algorithm: Algorithm,
authentication_key: K,
) -> Result<u16, Error<ErrorKind>>where
K: Into<Key>,
pub fn change_authentication_key<K>(
&self,
key_id: u16,
algorithm: Algorithm,
authentication_key: K,
) -> Result<u16, Error<ErrorKind>>where
K: Into<Key>,
Change the authentication key used to establish the current session.
Available with firmware version 2.2.0 or later. Atomically replaces the key material while preserving all object metadata (ID, label, domains, capabilities, delegated capabilities).
Only the Authentication Key that was used to open the current session
can be changed with this command. The required capability is
change-authentication-key.
https://developers.yubico.com/YubiHSM2/Commands/Change_Authentication_Key.html
pub fn put_hmac_key<K>(
&self,
key_id: u16,
label: Label,
domains: Domain,
capabilities: Capability,
algorithm: Algorithm,
key_bytes: K,
) -> Result<u16, Error<ErrorKind>>
pub fn put_hmac_key<K>( &self, key_id: u16, label: Label, domains: Domain, capabilities: Capability, algorithm: Algorithm, key_bytes: K, ) -> Result<u16, Error<ErrorKind>>
Put an existing HMAC key into the HSM.
pub fn put_opaque<B>(
&self,
object_id: u16,
label: Label,
domains: Domain,
capabilities: Capability,
algorithm: Algorithm,
opaque_data: B,
) -> Result<u16, Error<ErrorKind>>
pub fn put_opaque<B>( &self, object_id: u16, label: Label, domains: Domain, capabilities: Capability, algorithm: Algorithm, opaque_data: B, ) -> Result<u16, Error<ErrorKind>>
Put an opaque object (X.509 certificate or other bytestring) into the HSM.
pub fn put_otp_aead_key<K>(
&self,
key_id: u16,
label: Label,
domains: Domain,
capabilities: Capability,
algorithm: Algorithm,
key_bytes: K,
) -> Result<u16, Error<ErrorKind>>
pub fn put_otp_aead_key<K>( &self, key_id: u16, label: Label, domains: Domain, capabilities: Capability, algorithm: Algorithm, key_bytes: K, ) -> Result<u16, Error<ErrorKind>>
Put an existing OTP AEAD key into the HSM.
pub fn put_symmetric_key<K>(
&self,
key_id: u16,
label: Label,
domains: Domain,
capabilities: Capability,
algorithm: Algorithm,
key_bytes: K,
) -> Result<u16, Error<ErrorKind>>
pub fn put_symmetric_key<K>( &self, key_id: u16, label: Label, domains: Domain, capabilities: Capability, algorithm: Algorithm, key_bytes: K, ) -> Result<u16, Error<ErrorKind>>
Put an existing symmetric key into the HSM.
pub fn put_wrap_key<K>(
&self,
key_id: u16,
label: Label,
domains: Domain,
capabilities: Capability,
delegated_capabilities: Capability,
algorithm: Algorithm,
key_bytes: K,
) -> Result<u16, Error<ErrorKind>>
pub fn put_wrap_key<K>( &self, key_id: u16, label: Label, domains: Domain, capabilities: Capability, delegated_capabilities: Capability, algorithm: Algorithm, key_bytes: K, ) -> Result<u16, Error<ErrorKind>>
Put an existing wrap key into the HSM.
pub fn put_template<T>(
&self,
object_id: u16,
label: Label,
domains: Domain,
capabilities: Capability,
template: T,
) -> Result<u16, Error<ErrorKind>>where
T: Into<Template>,
pub fn put_template<T>(
&self,
object_id: u16,
label: Label,
domains: Domain,
capabilities: Capability,
template: T,
) -> Result<u16, Error<ErrorKind>>where
T: Into<Template>,
Put a template object (i.e. for SSH CA) into the HSM.
Use the [Template] type for SSH CA templates.
pub fn reset_device(&self) -> Result<(), Error<ErrorKind>>
pub fn reset_device(&self) -> Result<(), Error<ErrorKind>>
Reset the HSM to a factory default state and reboot, clearing all stored objects and restoring the default auth key.
WARNING: This wipes all keys and other data from the HSM! Make absolutely sure you want to use this!
pub fn reset_device_and_reconnect(
&mut self,
timeout: Duration,
) -> Result<(), Error<ErrorKind>>
pub fn reset_device_and_reconnect( &mut self, timeout: Duration, ) -> Result<(), Error<ErrorKind>>
Reset the HSM to a factory default state and reboot, clearing all stored objects and restoring the default auth key. This method further attempts to wait for the HSM to finish resetting and then attempts to reauthenticate with the default credentials.
Upon successfully resetting the device and authenticating using the
default administrator credentials in key slot 0x01, a new
Client is returned.
WARNING: This wipes all keys and other data from the HSM! Make absolutely sure you want to use this!
pub fn set_command_audit_option(
&self,
command: Code,
audit_option: AuditOption,
) -> Result<(), Error<ErrorKind>>
pub fn set_command_audit_option( &self, command: Code, audit_option: AuditOption, ) -> Result<(), Error<ErrorKind>>
Configure the audit policy settings for a particular command, e.g. auditing
should be On, Off, or Fix (i.e. fixed permanently on).
pub fn set_force_audit_option(
&self,
option: AuditOption,
) -> Result<(), Error<ErrorKind>>
pub fn set_force_audit_option( &self, option: AuditOption, ) -> Result<(), Error<ErrorKind>>
Put the forced auditing global option: when enabled, the device will refuse operations if the log store becomes full.
Options are On, Off, or Fix (i.e. fixed permanently on)
pub fn set_fips_option(
&self,
option: AuditOption,
) -> Result<(), Error<ErrorKind>>
pub fn set_fips_option( &self, option: AuditOption, ) -> Result<(), Error<ErrorKind>>
Put the FIPS global option: when enabled, it disables algorithms that are not allowed by FIPS 140.
Options are Off, or On
pub fn set_log_index(&self, log_index: u16) -> Result<(), Error<ErrorKind>>
pub fn set_log_index(&self, log_index: u16) -> Result<(), Error<ErrorKind>>
Set the index of the last consumed index of the HSM audit log.
pub fn sign_attestation_certificate(
&self,
key_id: u16,
attestation_key_id: Option<u16>,
) -> Result<Certificate, Error<ErrorKind>>
pub fn sign_attestation_certificate( &self, key_id: u16, attestation_key_id: Option<u16>, ) -> Result<Certificate, Error<ErrorKind>>
Obtain an X.509 attestation certificate for a key within the HSM. This can be used to demonstrate that a given key was generated by and stored within a HSM in a non-exportable manner.
The key_id is the subject key for which an attestation certificate
is created, and theattestation_key_id will be used to sign the
attestation certificate.
If no attestation key is given, the device’s default attestation key will be used, and can be verified against Yubico’s certificate.
pub fn sign_ecdsa_prehash_raw<T>(
&self,
key_id: u16,
digest: T,
) -> Result<Vec<u8>, Error<ErrorKind>>
pub fn sign_ecdsa_prehash_raw<T>( &self, key_id: u16, digest: T, ) -> Result<Vec<u8>, Error<ErrorKind>>
Compute an ECDSA signature of the given digest (i.e. a precomputed SHA-2 digest)
§Security Warning
This is a low-level ECDSA API, and if used incorrectly could potentially result in forgeable signatures.
We recommend using the [ecdsa::Signer] type instead, which provides a
high-level, well-typed, misuse resistant API.
pub fn sign_ed25519<T>(
&self,
key_id: u16,
data: T,
) -> Result<Signature, Error<ErrorKind>>
pub fn sign_ed25519<T>( &self, key_id: u16, data: T, ) -> Result<Signature, Error<ErrorKind>>
Compute an Ed25519 signature with the given key ID.
pub fn sign_hmac<M>(&self, key_id: u16, msg: M) -> Result<Tag, Error<ErrorKind>>
pub fn sign_hmac<M>(&self, key_id: u16, msg: M) -> Result<Tag, Error<ErrorKind>>
Compute an HMAC tag of the given data with the given key ID.
pub fn sign_rsa_pkcs1v15_sha256(
&self,
key_id: u16,
data: &[u8],
) -> Result<Signature, Error<ErrorKind>>
pub fn sign_rsa_pkcs1v15_sha256( &self, key_id: u16, data: &[u8], ) -> Result<Signature, Error<ErrorKind>>
Compute an RSASSA-PKCS#1v1.5 signature of the SHA-256 hash of the given data.
pub fn sign_rsa_pss_sha256(
&self,
key_id: u16,
data: &[u8],
) -> Result<Signature, Error<ErrorKind>>
pub fn sign_rsa_pss_sha256( &self, key_id: u16, data: &[u8], ) -> Result<Signature, Error<ErrorKind>>
Compute an RSASSA-PSS signature of the SHA-256 hash of the given data with the given key ID.
https://docs.yubico.com/hardware/yubihsm-2/hsm-2-user-guide/hsm2-cmd-reference.html#sign-pss-command
pub fn unwrap_data<M>(
&self,
wrap_key_id: u16,
wrap_message: M,
) -> Result<Vec<u8>, Error<ErrorKind>>where
M: Into<Message>,
pub fn unwrap_data<M>(
&self,
wrap_key_id: u16,
wrap_message: M,
) -> Result<Vec<u8>, Error<ErrorKind>>where
M: Into<Message>,
Decrypt data which was encrypted (using AES-CCM) under a wrap key.
pub fn verify_hmac<M, T>(
&self,
key_id: u16,
msg: M,
tag: T,
) -> Result<(), Error<ErrorKind>>
pub fn verify_hmac<M, T>( &self, key_id: u16, msg: M, tag: T, ) -> Result<(), Error<ErrorKind>>
Verify an HMAC tag of the given data with the given key ID.
Trait Implementations§
Auto Trait Implementations§
impl !RefUnwindSafe for Client
impl !UnwindSafe for Client
impl Freeze for Client
impl Send for Client
impl Sync for Client
impl Unpin for Client
impl UnsafeUnpin for Client
Blanket Implementations§
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,
§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,
§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) -> R
fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> R
§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
§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.§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.§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.§impl<T> Tap for T
impl<T> Tap for T
§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 more§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 more§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 more§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 more§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 more§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 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)) -> Self
fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Self
.tap_borrow() only in debug builds, and is erased in release
builds.§fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Self
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.§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.§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.§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.