Struct elliptic_curve::SecretKey
source · pub struct SecretKey<C: Curve> { /* private fields */ }
Expand description
Elliptic curve secret keys.
This type wraps a secret scalar value, helping to prevent accidental exposure and securely erasing the value from memory when dropped.
Parsing PKCS#8 Keys
PKCS#8 is a commonly used format for encoding secret keys (especially ones generated by OpenSSL).
Keys in PKCS#8 format are either binary (ASN.1 BER/DER), or PEM encoded (ASCII) and begin with the following:
-----BEGIN PRIVATE KEY-----
To decode an elliptic curve private key from PKCS#8, enable the pkcs8
feature of this crate (or the pkcs8
feature of a specific RustCrypto
elliptic curve crate) and use the DecodePrivateKey
trait to parse it.
When the pem
feature of this crate (or a specific RustCrypto elliptic
curve crate) is enabled, a FromStr
impl is also available.
Implementations§
source§impl<C> SecretKey<C>where
C: Curve,
impl<C> SecretKey<C>where C: Curve,
sourcepub fn random(rng: &mut impl CryptoRngCore) -> Selfwhere
C: CurveArithmetic,
Available on crate feature arithmetic
only.
pub fn random(rng: &mut impl CryptoRngCore) -> Selfwhere C: CurveArithmetic,
arithmetic
only.Generate a random SecretKey
.
sourcepub fn new(scalar: ScalarPrimitive<C>) -> Self
pub fn new(scalar: ScalarPrimitive<C>) -> Self
Create a new secret key from a scalar value.
sourcepub fn as_scalar_primitive(&self) -> &ScalarPrimitive<C>
pub fn as_scalar_primitive(&self) -> &ScalarPrimitive<C>
Borrow the inner secret ScalarPrimitive
value.
⚠️ Warning
This value is key material.
Please treat it with the care it deserves!
sourcepub fn to_nonzero_scalar(&self) -> NonZeroScalar<C>where
C: CurveArithmetic,
Available on crate feature arithmetic
only.
pub fn to_nonzero_scalar(&self) -> NonZeroScalar<C>where C: CurveArithmetic,
arithmetic
only.Get the secret NonZeroScalar
value for this key.
⚠️ Warning
This value is key material.
Please treat it with the care it deserves!
sourcepub fn public_key(&self) -> PublicKey<C>where
C: CurveArithmetic,
Available on crate feature arithmetic
only.
pub fn public_key(&self) -> PublicKey<C>where C: CurveArithmetic,
arithmetic
only.Get the PublicKey
which corresponds to this secret key
sourcepub fn from_bytes(bytes: &FieldBytes<C>) -> Result<Self>
pub fn from_bytes(bytes: &FieldBytes<C>) -> Result<Self>
Deserialize secret key from an encoded secret scalar.
sourcepub fn from_slice(slice: &[u8]) -> Result<Self>
pub fn from_slice(slice: &[u8]) -> Result<Self>
Deserialize secret key from an encoded secret scalar passed as a byte slice.
The slice is expected to be a minimum of 24-bytes (192-byts) and at most C::FieldBytesSize
bytes in length.
Byte slices shorter than the field size are handled by zero padding the input.
sourcepub fn to_bytes(&self) -> FieldBytes<C>
pub fn to_bytes(&self) -> FieldBytes<C>
Serialize raw secret scalar as a big endian integer.
sourcepub fn from_sec1_der(der_bytes: &[u8]) -> Result<Self>where
C: Curve + ValidatePublicKey,
FieldBytesSize<C>: ModulusSize,
Available on crate feature sec1
only.
pub fn from_sec1_der(der_bytes: &[u8]) -> Result<Self>where C: Curve + ValidatePublicKey, FieldBytesSize<C>: ModulusSize,
sec1
only.Deserialize secret key encoded in the SEC1 ASN.1 DER ECPrivateKey
format.
sourcepub fn to_sec1_der(&self) -> Result<Zeroizing<Vec<u8>>>where
C: CurveArithmetic,
AffinePoint<C>: FromEncodedPoint<C> + ToEncodedPoint<C>,
FieldBytesSize<C>: ModulusSize,
Available on crate features alloc
and arithmetic
and sec1
only.
pub fn to_sec1_der(&self) -> Result<Zeroizing<Vec<u8>>>where C: CurveArithmetic, AffinePoint<C>: FromEncodedPoint<C> + ToEncodedPoint<C>, FieldBytesSize<C>: ModulusSize,
alloc
and arithmetic
and sec1
only.Serialize secret key in the SEC1 ASN.1 DER ECPrivateKey
format.
sourcepub fn from_sec1_pem(s: &str) -> Result<Self>where
C: Curve + ValidatePublicKey,
FieldBytesSize<C>: ModulusSize,
Available on crate feature pem
only.
pub fn from_sec1_pem(s: &str) -> Result<Self>where C: Curve + ValidatePublicKey, FieldBytesSize<C>: ModulusSize,
pem
only.Parse SecretKey
from PEM-encoded SEC1 ECPrivateKey
format.
PEM-encoded SEC1 keys can be identified by the leading delimiter:
-----BEGIN EC PRIVATE KEY-----
sourcepub fn to_sec1_pem(&self, line_ending: LineEnding) -> Result<Zeroizing<String>>where
C: CurveArithmetic,
AffinePoint<C>: FromEncodedPoint<C> + ToEncodedPoint<C>,
FieldBytesSize<C>: ModulusSize,
Available on crate feature pem
only.
pub fn to_sec1_pem(&self, line_ending: LineEnding) -> Result<Zeroizing<String>>where C: CurveArithmetic, AffinePoint<C>: FromEncodedPoint<C> + ToEncodedPoint<C>, FieldBytesSize<C>: ModulusSize,
pem
only.Serialize private key as self-zeroizing PEM-encoded SEC1 ECPrivateKey
with the given pem::LineEnding
.
Pass Default::default()
to use the OS’s native line endings.
sourcepub fn from_jwk(jwk: &JwkEcKey) -> Result<Self>where
C: JwkParameters + ValidatePublicKey,
FieldBytesSize<C>: ModulusSize,
Available on crate feature jwk
only.
pub fn from_jwk(jwk: &JwkEcKey) -> Result<Self>where C: JwkParameters + ValidatePublicKey, FieldBytesSize<C>: ModulusSize,
jwk
only.sourcepub fn from_jwk_str(jwk: &str) -> Result<Self>where
C: JwkParameters + ValidatePublicKey,
FieldBytesSize<C>: ModulusSize,
Available on crate feature jwk
only.
pub fn from_jwk_str(jwk: &str) -> Result<Self>where C: JwkParameters + ValidatePublicKey, FieldBytesSize<C>: ModulusSize,
jwk
only.Parse a string containing a JSON Web Key (JWK) into a SecretKey
.
sourcepub fn to_jwk(&self) -> JwkEcKeywhere
C: CurveArithmetic + JwkParameters,
AffinePoint<C>: FromEncodedPoint<C> + ToEncodedPoint<C>,
FieldBytesSize<C>: ModulusSize,
Available on crate features arithmetic
and jwk
only.
pub fn to_jwk(&self) -> JwkEcKeywhere C: CurveArithmetic + JwkParameters, AffinePoint<C>: FromEncodedPoint<C> + ToEncodedPoint<C>, FieldBytesSize<C>: ModulusSize,
arithmetic
and jwk
only.Serialize this secret key as JwkEcKey
JSON Web Key (JWK).
sourcepub fn to_jwk_string(&self) -> Zeroizing<String>where
C: CurveArithmetic + JwkParameters,
AffinePoint<C>: FromEncodedPoint<C> + ToEncodedPoint<C>,
FieldBytesSize<C>: ModulusSize,
Available on crate features arithmetic
and jwk
only.
pub fn to_jwk_string(&self) -> Zeroizing<String>where C: CurveArithmetic + JwkParameters, AffinePoint<C>: FromEncodedPoint<C> + ToEncodedPoint<C>, FieldBytesSize<C>: ModulusSize,
arithmetic
and jwk
only.Serialize this secret key as JSON Web Key (JWK) string.
Trait Implementations§
source§impl<C> AssociatedAlgorithmIdentifier for SecretKey<C>where
C: AssociatedOid + Curve,
Available on crate features pkcs8
and sec1
only.
impl<C> AssociatedAlgorithmIdentifier for SecretKey<C>where C: AssociatedOid + Curve,
pkcs8
and sec1
only.source§const ALGORITHM_IDENTIFIER: AlgorithmIdentifier<ObjectIdentifier> = _
const ALGORITHM_IDENTIFIER: AlgorithmIdentifier<ObjectIdentifier> = _
AlgorithmIdentifier
for this structure.source§impl<C> ConstantTimeEq for SecretKey<C>where
C: Curve,
impl<C> ConstantTimeEq for SecretKey<C>where C: Curve,
source§impl<C> EncodePrivateKey for SecretKey<C>where
C: AssociatedOid + CurveArithmetic,
AffinePoint<C>: FromEncodedPoint<C> + ToEncodedPoint<C>,
FieldBytesSize<C>: ModulusSize,
Available on crate features pkcs8
and sec1
and alloc
and arithmetic
only.
impl<C> EncodePrivateKey for SecretKey<C>where C: AssociatedOid + CurveArithmetic, AffinePoint<C>: FromEncodedPoint<C> + ToEncodedPoint<C>, FieldBytesSize<C>: ModulusSize,
pkcs8
and sec1
and alloc
and arithmetic
only.source§fn to_pkcs8_der(&self) -> Result<SecretDocument>
fn to_pkcs8_der(&self) -> Result<SecretDocument>
SecretDocument
] containing a PKCS#8-encoded private key.source§fn to_pkcs8_pem(
&self,
line_ending: LineEnding
) -> Result<Zeroizing<String>, Error>
fn to_pkcs8_pem( &self, line_ending: LineEnding ) -> Result<Zeroizing<String>, Error>
pem
only.LineEnding
.source§fn write_pkcs8_der_file(&self, path: impl AsRef<Path>) -> Result<(), Error>
fn write_pkcs8_der_file(&self, path: impl AsRef<Path>) -> Result<(), Error>
std
only.source§fn write_pkcs8_pem_file(
&self,
path: impl AsRef<Path>,
line_ending: LineEnding
) -> Result<(), Error>
fn write_pkcs8_pem_file( &self, path: impl AsRef<Path>, line_ending: LineEnding ) -> Result<(), Error>
pem
and std
only.source§impl<C> From<&NonZeroScalar<C>> for SecretKey<C>where
C: CurveArithmetic,
Available on crate feature arithmetic
only.
impl<C> From<&NonZeroScalar<C>> for SecretKey<C>where C: CurveArithmetic,
arithmetic
only.source§fn from(scalar: &NonZeroScalar<C>) -> SecretKey<C>
fn from(scalar: &NonZeroScalar<C>) -> SecretKey<C>
source§impl<C> From<&SecretKey<C>> for JwkEcKeywhere
C: CurveArithmetic + JwkParameters,
AffinePoint<C>: FromEncodedPoint<C> + ToEncodedPoint<C>,
FieldBytesSize<C>: ModulusSize,
Available on crate features jwk
and arithmetic
only.
impl<C> From<&SecretKey<C>> for JwkEcKeywhere C: CurveArithmetic + JwkParameters, AffinePoint<C>: FromEncodedPoint<C> + ToEncodedPoint<C>, FieldBytesSize<C>: ModulusSize,
jwk
and arithmetic
only.source§impl<C> From<&SecretKey<C>> for NonZeroScalar<C>where
C: CurveArithmetic,
Available on crate feature arithmetic
only.
impl<C> From<&SecretKey<C>> for NonZeroScalar<C>where C: CurveArithmetic,
arithmetic
only.source§fn from(sk: &SecretKey<C>) -> NonZeroScalar<C>
fn from(sk: &SecretKey<C>) -> NonZeroScalar<C>
source§impl<C> From<NonZeroScalar<C>> for SecretKey<C>where
C: CurveArithmetic,
Available on crate feature arithmetic
only.
impl<C> From<NonZeroScalar<C>> for SecretKey<C>where C: CurveArithmetic,
arithmetic
only.source§fn from(scalar: NonZeroScalar<C>) -> SecretKey<C>
fn from(scalar: NonZeroScalar<C>) -> SecretKey<C>
source§impl<C> From<SecretKey<C>> for JwkEcKeywhere
C: CurveArithmetic + JwkParameters,
AffinePoint<C>: FromEncodedPoint<C> + ToEncodedPoint<C>,
FieldBytesSize<C>: ModulusSize,
Available on crate features jwk
and arithmetic
only.
impl<C> From<SecretKey<C>> for JwkEcKeywhere C: CurveArithmetic + JwkParameters, AffinePoint<C>: FromEncodedPoint<C> + ToEncodedPoint<C>, FieldBytesSize<C>: ModulusSize,
jwk
and arithmetic
only.source§impl<C> From<SecretKey<C>> for NonZeroScalar<C>where
C: CurveArithmetic,
Available on crate feature arithmetic
only.
impl<C> From<SecretKey<C>> for NonZeroScalar<C>where C: CurveArithmetic,
arithmetic
only.source§fn from(sk: SecretKey<C>) -> NonZeroScalar<C>
fn from(sk: SecretKey<C>) -> NonZeroScalar<C>
source§impl<C> FromStr for SecretKey<C>where
C: Curve + AssociatedOid + ValidatePublicKey,
FieldBytesSize<C>: ModulusSize,
Available on crate features pkcs8
and sec1
and pem
only.
impl<C> FromStr for SecretKey<C>where C: Curve + AssociatedOid + ValidatePublicKey, FieldBytesSize<C>: ModulusSize,
pkcs8
and sec1
and pem
only.source§impl<C> PartialEq for SecretKey<C>where
C: Curve,
impl<C> PartialEq for SecretKey<C>where C: Curve,
source§impl<C> TryFrom<&JwkEcKey> for SecretKey<C>where
C: Curve + JwkParameters + ValidatePublicKey,
FieldBytesSize<C>: ModulusSize,
Available on crate feature jwk
only.
impl<C> TryFrom<&JwkEcKey> for SecretKey<C>where C: Curve + JwkParameters + ValidatePublicKey, FieldBytesSize<C>: ModulusSize,
jwk
only.source§impl<C> TryFrom<EcPrivateKey<'_>> for SecretKey<C>where
C: Curve + ValidatePublicKey,
FieldBytesSize<C>: ModulusSize,
Available on crate feature sec1
only.
impl<C> TryFrom<EcPrivateKey<'_>> for SecretKey<C>where C: Curve + ValidatePublicKey, FieldBytesSize<C>: ModulusSize,
sec1
only.source§impl<C> TryFrom<JwkEcKey> for SecretKey<C>where
C: Curve + JwkParameters + ValidatePublicKey,
FieldBytesSize<C>: ModulusSize,
Available on crate feature jwk
only.
impl<C> TryFrom<JwkEcKey> for SecretKey<C>where C: Curve + JwkParameters + ValidatePublicKey, FieldBytesSize<C>: ModulusSize,
jwk
only.source§impl<C> TryFrom<PrivateKeyInfo<'_>> for SecretKey<C>where
C: AssociatedOid + Curve + ValidatePublicKey,
FieldBytesSize<C>: ModulusSize,
Available on crate features pkcs8
and sec1
only.
impl<C> TryFrom<PrivateKeyInfo<'_>> for SecretKey<C>where C: AssociatedOid + Curve + ValidatePublicKey, FieldBytesSize<C>: ModulusSize,
pkcs8
and sec1
only.impl<C: Curve> Eq for SecretKey<C>
impl<C> ZeroizeOnDrop for SecretKey<C>where C: Curve,
Auto Trait Implementations§
impl<C> RefUnwindSafe for SecretKey<C>where <C as Curve>::Uint: RefUnwindSafe,
impl<C> Send for SecretKey<C>
impl<C> Sync for SecretKey<C>
impl<C> Unpin for SecretKey<C>where <C as Curve>::Uint: Unpin,
impl<C> UnwindSafe for SecretKey<C>where <C as Curve>::Uint: UnwindSafe,
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> DecodeEcPrivateKey for Twhere
T: for<'a> TryFrom<PrivateKeyInfo<'a>, Error = Error>,
impl<T> DecodeEcPrivateKey for Twhere T: for<'a> TryFrom<PrivateKeyInfo<'a>, Error = Error>,
source§fn from_sec1_der(private_key: &[u8]) -> Result<T, Error>
fn from_sec1_der(private_key: &[u8]) -> Result<T, Error>
source§fn from_sec1_pem(s: &str) -> Result<Self, Error>
fn from_sec1_pem(s: &str) -> Result<Self, Error>
pem
only.source§impl<T> DecodePrivateKey for Twhere
T: for<'a> TryFrom<PrivateKeyInfo<'a>, Error = Error>,
impl<T> DecodePrivateKey for Twhere T: for<'a> TryFrom<PrivateKeyInfo<'a>, Error = Error>,
source§fn from_pkcs8_der(bytes: &[u8]) -> Result<T, Error>
fn from_pkcs8_der(bytes: &[u8]) -> Result<T, Error>
source§fn from_pkcs8_pem(s: &str) -> Result<Self, Error>
fn from_pkcs8_pem(s: &str) -> Result<Self, Error>
pem
only.§impl<T> DynAssociatedAlgorithmIdentifier for Twhere
T: AssociatedAlgorithmIdentifier,
impl<T> DynAssociatedAlgorithmIdentifier for Twhere T: AssociatedAlgorithmIdentifier,
§fn algorithm_identifier(&self) -> Result<AlgorithmIdentifier<Any>, Error>
fn algorithm_identifier(&self) -> Result<AlgorithmIdentifier<Any>, Error>
AlgorithmIdentifier
for this structure.source§impl<T> EncodeEcPrivateKey for Twhere
T: EncodePrivateKey,
impl<T> EncodeEcPrivateKey for Twhere T: EncodePrivateKey,
source§fn to_sec1_der(&self) -> Result<SecretDocument, Error>
fn to_sec1_der(&self) -> Result<SecretDocument, Error>
SecretDocument
] containing a SEC1-encoded private key.source§fn to_sec1_pem(
&self,
line_ending: LineEnding
) -> Result<Zeroizing<String>, Error>
fn to_sec1_pem( &self, line_ending: LineEnding ) -> Result<Zeroizing<String>, Error>
pem
only.LineEnding
. Read moresource§fn write_sec1_der_file(&self, path: impl AsRef<Path>) -> Result<(), Error>
fn write_sec1_der_file(&self, path: impl AsRef<Path>) -> Result<(), Error>
std
only.source§fn write_sec1_pem_file(
&self,
path: impl AsRef<Path>,
line_ending: LineEnding
) -> Result<(), Error>
fn write_sec1_pem_file( &self, path: impl AsRef<Path>, line_ending: LineEnding ) -> Result<(), Error>
pem
and std
only.§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> 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) -> 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,
source§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,
source§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.source§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.source§impl<T> Tap for T
impl<T> Tap for T
source§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 moresource§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 moresource§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 moresource§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 moresource§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 moresource§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 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)) -> 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.source§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.source§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.source§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.