pub struct RistrettoPoint(/* private fields */);
Expand description
A RistrettoPoint
represents a point in the Ristretto group for
Curve25519. Ristretto, a variant of Decaf, constructs a
prime-order group as a quotient group of a subgroup of (the
Edwards form of) Curve25519.
Internally, a RistrettoPoint
is implemented as a wrapper type
around EdwardsPoint
, with custom equality, compression, and
decompression routines to account for the quotient. This means that
operations on RistrettoPoint
s are exactly as fast as operations on
EdwardsPoint
s.
Implementations§
Source§impl RistrettoPoint
impl RistrettoPoint
Sourcepub fn compress(&self) -> CompressedRistretto
pub fn compress(&self) -> CompressedRistretto
Compress this point using the Ristretto encoding.
Sourcepub fn double_and_compress_batch<'a, I>(points: I) -> Vec<CompressedRistretto>where
I: IntoIterator<Item = &'a RistrettoPoint>,
pub fn double_and_compress_batch<'a, I>(points: I) -> Vec<CompressedRistretto>where
I: IntoIterator<Item = &'a RistrettoPoint>,
Double-and-compress a batch of points. The Ristretto encoding is not batchable, since it requires an inverse square root.
However, given input points \( P_1, \ldots, P_n, \) it is possible to compute the encodings of their doubles \( \mathrm{enc}( [2]P_1), \ldots, \mathrm{enc}( [2]P_n ) \) in a batch.
use rand_core::OsRng;
let mut rng = OsRng;
let points: Vec<RistrettoPoint> =
(0..32).map(|_| RistrettoPoint::random(&mut rng)).collect();
let compressed = RistrettoPoint::double_and_compress_batch(&points);
for (P, P2_compressed) in points.iter().zip(compressed.iter()) {
assert_eq!(*P2_compressed, (P + P).compress());
}
Sourcepub fn random<R>(rng: &mut R) -> RistrettoPointwhere
R: CryptoRngCore + ?Sized,
pub fn random<R>(rng: &mut R) -> RistrettoPointwhere
R: CryptoRngCore + ?Sized,
Return a RistrettoPoint
chosen uniformly at random using a user-provided RNG.
§Inputs
rng
: any RNG which implementsCryptoRngCore
(i.e.CryptoRng
+RngCore
) interface.
§Returns
A random element of the Ristretto group.
§Implementation
Uses the Ristretto-flavoured Elligator 2 map, so that the discrete log of the output point with respect to any other point should be unknown. The map is applied twice and the results are added, to ensure a uniform distribution.
Sourcepub fn hash_from_bytes<D>(input: &[u8]) -> RistrettoPoint
pub fn hash_from_bytes<D>(input: &[u8]) -> RistrettoPoint
Hash a slice of bytes into a RistrettoPoint
.
Takes a type parameter D
, which is any Digest
producing 64
bytes of output.
Convenience wrapper around from_hash
.
§Implementation
Uses the Ristretto-flavoured Elligator 2 map, so that the discrete log of the output point with respect to any other point should be unknown. The map is applied twice and the results are added, to ensure a uniform distribution.
§Example
use sha2::Sha512;
let msg = "To really appreciate architecture, you may even need to commit a murder";
let P = RistrettoPoint::hash_from_bytes::<Sha512>(msg.as_bytes());
Sourcepub fn from_hash<D>(hash: D) -> RistrettoPoint
pub fn from_hash<D>(hash: D) -> RistrettoPoint
Construct a RistrettoPoint
from an existing Digest
instance.
Use this instead of hash_from_bytes
if it is more convenient
to stream data into the Digest
than to pass a single byte
slice.
Sourcepub fn from_uniform_bytes(bytes: &[u8; 64]) -> RistrettoPoint
pub fn from_uniform_bytes(bytes: &[u8; 64]) -> RistrettoPoint
Construct a RistrettoPoint
from 64 bytes of data.
If the input bytes are uniformly distributed, the resulting point will be uniformly distributed over the group, and its discrete log with respect to other points should be unknown.
§Implementation
This function splits the input array into two 32-byte halves, takes the low 255 bits of each half mod p, applies the Ristretto-flavored Elligator map to each, and adds the results.
Source§impl RistrettoPoint
impl RistrettoPoint
Sourcepub fn mul_base(scalar: &Scalar) -> RistrettoPoint
pub fn mul_base(scalar: &Scalar) -> RistrettoPoint
Fixed-base scalar multiplication by the Ristretto base point.
Uses precomputed basepoint tables when the precomputed-tables
feature
is enabled, trading off increased code size for ~4x better performance.
Source§impl RistrettoPoint
impl RistrettoPoint
Sourcepub fn vartime_double_scalar_mul_basepoint(
a: &Scalar,
A: &RistrettoPoint,
b: &Scalar,
) -> RistrettoPoint
pub fn vartime_double_scalar_mul_basepoint( a: &Scalar, A: &RistrettoPoint, b: &Scalar, ) -> RistrettoPoint
Compute \(aA + bB\) in variable time, where \(B\) is the Ristretto basepoint.
Trait Implementations§
Source§impl<'a, 'b> Add<&'b RistrettoPoint> for &'a RistrettoPoint
impl<'a, 'b> Add<&'b RistrettoPoint> for &'a RistrettoPoint
Source§type Output = RistrettoPoint
type Output = RistrettoPoint
+
operator.Source§fn add(self, other: &'b RistrettoPoint) -> RistrettoPoint
fn add(self, other: &'b RistrettoPoint) -> RistrettoPoint
+
operation. Read moreSource§impl<'b> Add<&'b RistrettoPoint> for RistrettoPoint
impl<'b> Add<&'b RistrettoPoint> for RistrettoPoint
Source§type Output = RistrettoPoint
type Output = RistrettoPoint
+
operator.Source§fn add(self, rhs: &'b RistrettoPoint) -> RistrettoPoint
fn add(self, rhs: &'b RistrettoPoint) -> RistrettoPoint
+
operation. Read moreSource§impl<'a> Add<RistrettoPoint> for &'a RistrettoPoint
impl<'a> Add<RistrettoPoint> for &'a RistrettoPoint
Source§type Output = RistrettoPoint
type Output = RistrettoPoint
+
operator.Source§fn add(self, rhs: RistrettoPoint) -> RistrettoPoint
fn add(self, rhs: RistrettoPoint) -> RistrettoPoint
+
operation. Read moreSource§impl Add for RistrettoPoint
impl Add for RistrettoPoint
Source§type Output = RistrettoPoint
type Output = RistrettoPoint
+
operator.Source§fn add(self, rhs: RistrettoPoint) -> RistrettoPoint
fn add(self, rhs: RistrettoPoint) -> RistrettoPoint
+
operation. Read moreSource§impl<'b> AddAssign<&'b RistrettoPoint> for RistrettoPoint
impl<'b> AddAssign<&'b RistrettoPoint> for RistrettoPoint
Source§fn add_assign(&mut self, _rhs: &RistrettoPoint)
fn add_assign(&mut self, _rhs: &RistrettoPoint)
+=
operation. Read moreSource§impl AddAssign for RistrettoPoint
impl AddAssign for RistrettoPoint
Source§fn add_assign(&mut self, rhs: RistrettoPoint)
fn add_assign(&mut self, rhs: RistrettoPoint)
+=
operation. Read moreSource§impl Clone for RistrettoPoint
impl Clone for RistrettoPoint
Source§fn clone(&self) -> RistrettoPoint
fn clone(&self) -> RistrettoPoint
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moreSource§impl CofactorGroup for RistrettoPoint
Ristretto has a cofactor of 1.
impl CofactorGroup for RistrettoPoint
Ristretto has a cofactor of 1.
Source§type Subgroup = RistrettoPoint
type Subgroup = RistrettoPoint
Self
implements PrimeGroup
, then Self::Subgroup
may be Self
.Source§fn clear_cofactor(&self) -> <RistrettoPoint as CofactorGroup>::Subgroup
fn clear_cofactor(&self) -> <RistrettoPoint as CofactorGroup>::Subgroup
self
to the prime-order subgroup by multiplying this element by some
k
-multiple of the cofactor. Read moreSource§fn into_subgroup(self) -> CtOption<<RistrettoPoint as CofactorGroup>::Subgroup>
fn into_subgroup(self) -> CtOption<<RistrettoPoint as CofactorGroup>::Subgroup>
self
if it is contained in the prime-order subgroup. Read moreSource§fn is_torsion_free(&self) -> Choice
fn is_torsion_free(&self) -> Choice
Source§fn is_small_order(&self) -> Choice
fn is_small_order(&self) -> Choice
Source§impl ConditionallySelectable for RistrettoPoint
impl ConditionallySelectable for RistrettoPoint
Source§fn conditional_select(
a: &RistrettoPoint,
b: &RistrettoPoint,
choice: Choice,
) -> RistrettoPoint
fn conditional_select( a: &RistrettoPoint, b: &RistrettoPoint, choice: Choice, ) -> RistrettoPoint
Conditionally select between self
and other
.
§Example
use subtle::ConditionallySelectable;
use subtle::Choice;
let A = RistrettoPoint::identity();
let B = constants::RISTRETTO_BASEPOINT_POINT;
let mut P = A;
P = RistrettoPoint::conditional_select(&A, &B, Choice::from(0));
assert_eq!(P, A);
P = RistrettoPoint::conditional_select(&A, &B, Choice::from(1));
assert_eq!(P, B);
Source§fn conditional_assign(&mut self, other: &Self, choice: Choice)
fn conditional_assign(&mut self, other: &Self, choice: Choice)
Source§fn conditional_swap(a: &mut Self, b: &mut Self, choice: Choice)
fn conditional_swap(a: &mut Self, b: &mut Self, choice: Choice)
self
and other
if choice == 1
; otherwise,
reassign both unto themselves. Read moreSource§impl ConstantTimeEq for RistrettoPoint
impl ConstantTimeEq for RistrettoPoint
Source§impl Debug for RistrettoPoint
impl Debug for RistrettoPoint
Source§impl Default for RistrettoPoint
impl Default for RistrettoPoint
Source§fn default() -> RistrettoPoint
fn default() -> RistrettoPoint
Source§impl Group for RistrettoPoint
impl Group for RistrettoPoint
Source§fn random(rng: impl RngCore) -> RistrettoPoint
fn random(rng: impl RngCore) -> RistrettoPoint
Source§fn identity() -> RistrettoPoint
fn identity() -> RistrettoPoint
Source§fn generator() -> RistrettoPoint
fn generator() -> RistrettoPoint
Source§fn is_identity(&self) -> Choice
fn is_identity(&self) -> Choice
Source§fn double(&self) -> RistrettoPoint
fn double(&self) -> RistrettoPoint
Source§impl GroupEncoding for RistrettoPoint
impl GroupEncoding for RistrettoPoint
Source§fn from_bytes(
bytes: &<RistrettoPoint as GroupEncoding>::Repr,
) -> CtOption<RistrettoPoint>
fn from_bytes( bytes: &<RistrettoPoint as GroupEncoding>::Repr, ) -> CtOption<RistrettoPoint>
Source§fn from_bytes_unchecked(
bytes: &<RistrettoPoint as GroupEncoding>::Repr,
) -> CtOption<RistrettoPoint>
fn from_bytes_unchecked( bytes: &<RistrettoPoint as GroupEncoding>::Repr, ) -> CtOption<RistrettoPoint>
Source§fn to_bytes(&self) -> <RistrettoPoint as GroupEncoding>::Repr
fn to_bytes(&self) -> <RistrettoPoint as GroupEncoding>::Repr
Source§impl Identity for RistrettoPoint
impl Identity for RistrettoPoint
Source§fn identity() -> RistrettoPoint
fn identity() -> RistrettoPoint
Source§impl<'a, 'b> Mul<&'b RistrettoPoint> for &'a Scalar
impl<'a, 'b> Mul<&'b RistrettoPoint> for &'a Scalar
Source§fn mul(self, point: &'b RistrettoPoint) -> RistrettoPoint
fn mul(self, point: &'b RistrettoPoint) -> RistrettoPoint
Scalar multiplication: compute self * scalar
.
Source§type Output = RistrettoPoint
type Output = RistrettoPoint
*
operator.Source§impl<'b> Mul<&'b RistrettoPoint> for Scalar
impl<'b> Mul<&'b RistrettoPoint> for Scalar
Source§type Output = RistrettoPoint
type Output = RistrettoPoint
*
operator.Source§fn mul(self, rhs: &'b RistrettoPoint) -> RistrettoPoint
fn mul(self, rhs: &'b RistrettoPoint) -> RistrettoPoint
*
operation. Read moreSource§impl<'a, 'b> Mul<&'b Scalar> for &'a RistrettoPoint
impl<'a, 'b> Mul<&'b Scalar> for &'a RistrettoPoint
Source§fn mul(self, scalar: &'b Scalar) -> RistrettoPoint
fn mul(self, scalar: &'b Scalar) -> RistrettoPoint
Scalar multiplication: compute scalar * self
.
Source§type Output = RistrettoPoint
type Output = RistrettoPoint
*
operator.Source§impl<'b> Mul<&'b Scalar> for RistrettoPoint
impl<'b> Mul<&'b Scalar> for RistrettoPoint
Source§type Output = RistrettoPoint
type Output = RistrettoPoint
*
operator.Source§impl<'a> Mul<RistrettoPoint> for &'a Scalar
impl<'a> Mul<RistrettoPoint> for &'a Scalar
Source§type Output = RistrettoPoint
type Output = RistrettoPoint
*
operator.Source§fn mul(self, rhs: RistrettoPoint) -> RistrettoPoint
fn mul(self, rhs: RistrettoPoint) -> RistrettoPoint
*
operation. Read moreSource§impl Mul<RistrettoPoint> for Scalar
impl Mul<RistrettoPoint> for Scalar
Source§type Output = RistrettoPoint
type Output = RistrettoPoint
*
operator.Source§fn mul(self, rhs: RistrettoPoint) -> RistrettoPoint
fn mul(self, rhs: RistrettoPoint) -> RistrettoPoint
*
operation. Read moreSource§impl<'a> Mul<Scalar> for &'a RistrettoPoint
impl<'a> Mul<Scalar> for &'a RistrettoPoint
Source§type Output = RistrettoPoint
type Output = RistrettoPoint
*
operator.Source§impl Mul<Scalar> for RistrettoPoint
impl Mul<Scalar> for RistrettoPoint
Source§type Output = RistrettoPoint
type Output = RistrettoPoint
*
operator.Source§impl<'b> MulAssign<&'b Scalar> for RistrettoPoint
impl<'b> MulAssign<&'b Scalar> for RistrettoPoint
Source§fn mul_assign(&mut self, scalar: &'b Scalar)
fn mul_assign(&mut self, scalar: &'b Scalar)
*=
operation. Read moreSource§impl MulAssign<Scalar> for RistrettoPoint
impl MulAssign<Scalar> for RistrettoPoint
Source§fn mul_assign(&mut self, rhs: Scalar)
fn mul_assign(&mut self, rhs: Scalar)
*=
operation. Read moreSource§impl MultiscalarMul for RistrettoPoint
impl MultiscalarMul for RistrettoPoint
Source§type Point = RistrettoPoint
type Point = RistrettoPoint
RistrettoPoint
.Source§fn multiscalar_mul<I, J>(scalars: I, points: J) -> RistrettoPointwhere
I: IntoIterator,
<I as IntoIterator>::Item: Borrow<Scalar>,
J: IntoIterator,
<J as IntoIterator>::Item: Borrow<RistrettoPoint>,
fn multiscalar_mul<I, J>(scalars: I, points: J) -> RistrettoPointwhere
I: IntoIterator,
<I as IntoIterator>::Item: Borrow<Scalar>,
J: IntoIterator,
<J as IntoIterator>::Item: Borrow<RistrettoPoint>,
Source§impl<'a> Neg for &'a RistrettoPoint
impl<'a> Neg for &'a RistrettoPoint
Source§type Output = RistrettoPoint
type Output = RistrettoPoint
-
operator.Source§fn neg(self) -> RistrettoPoint
fn neg(self) -> RistrettoPoint
-
operation. Read moreSource§impl Neg for RistrettoPoint
impl Neg for RistrettoPoint
Source§type Output = RistrettoPoint
type Output = RistrettoPoint
-
operator.Source§fn neg(self) -> RistrettoPoint
fn neg(self) -> RistrettoPoint
-
operation. Read moreSource§impl PartialEq for RistrettoPoint
impl PartialEq for RistrettoPoint
Source§impl<'a, 'b> Sub<&'b RistrettoPoint> for &'a RistrettoPoint
impl<'a, 'b> Sub<&'b RistrettoPoint> for &'a RistrettoPoint
Source§type Output = RistrettoPoint
type Output = RistrettoPoint
-
operator.Source§fn sub(self, other: &'b RistrettoPoint) -> RistrettoPoint
fn sub(self, other: &'b RistrettoPoint) -> RistrettoPoint
-
operation. Read moreSource§impl<'b> Sub<&'b RistrettoPoint> for RistrettoPoint
impl<'b> Sub<&'b RistrettoPoint> for RistrettoPoint
Source§type Output = RistrettoPoint
type Output = RistrettoPoint
-
operator.Source§fn sub(self, rhs: &'b RistrettoPoint) -> RistrettoPoint
fn sub(self, rhs: &'b RistrettoPoint) -> RistrettoPoint
-
operation. Read moreSource§impl<'a> Sub<RistrettoPoint> for &'a RistrettoPoint
impl<'a> Sub<RistrettoPoint> for &'a RistrettoPoint
Source§type Output = RistrettoPoint
type Output = RistrettoPoint
-
operator.Source§fn sub(self, rhs: RistrettoPoint) -> RistrettoPoint
fn sub(self, rhs: RistrettoPoint) -> RistrettoPoint
-
operation. Read moreSource§impl Sub for RistrettoPoint
impl Sub for RistrettoPoint
Source§type Output = RistrettoPoint
type Output = RistrettoPoint
-
operator.Source§fn sub(self, rhs: RistrettoPoint) -> RistrettoPoint
fn sub(self, rhs: RistrettoPoint) -> RistrettoPoint
-
operation. Read moreSource§impl<'b> SubAssign<&'b RistrettoPoint> for RistrettoPoint
impl<'b> SubAssign<&'b RistrettoPoint> for RistrettoPoint
Source§fn sub_assign(&mut self, _rhs: &RistrettoPoint)
fn sub_assign(&mut self, _rhs: &RistrettoPoint)
-=
operation. Read moreSource§impl SubAssign for RistrettoPoint
impl SubAssign for RistrettoPoint
Source§fn sub_assign(&mut self, rhs: RistrettoPoint)
fn sub_assign(&mut self, rhs: RistrettoPoint)
-=
operation. Read moreSource§impl<T> Sum<T> for RistrettoPointwhere
T: Borrow<RistrettoPoint>,
impl<T> Sum<T> for RistrettoPointwhere
T: Borrow<RistrettoPoint>,
Source§fn sum<I>(iter: I) -> RistrettoPointwhere
I: Iterator<Item = T>,
fn sum<I>(iter: I) -> RistrettoPointwhere
I: Iterator<Item = T>,
Self
from the elements by “summing up”
the items.Source§impl VartimeMultiscalarMul for RistrettoPoint
impl VartimeMultiscalarMul for RistrettoPoint
Source§type Point = RistrettoPoint
type Point = RistrettoPoint
RistrettoPoint
.Source§fn optional_multiscalar_mul<I, J>(
scalars: I,
points: J,
) -> Option<RistrettoPoint>where
I: IntoIterator,
<I as IntoIterator>::Item: Borrow<Scalar>,
J: IntoIterator<Item = Option<RistrettoPoint>>,
fn optional_multiscalar_mul<I, J>(
scalars: I,
points: J,
) -> Option<RistrettoPoint>where
I: IntoIterator,
<I as IntoIterator>::Item: Borrow<Scalar>,
J: IntoIterator<Item = Option<RistrettoPoint>>,
Option
s of points, compute either Some(Q)
, where
$$
Q = c_1 P_1 + \cdots + c_n P_n,
$$
if all points were Some(P_i)
, or else return None
. Read moreSource§fn vartime_multiscalar_mul<I, J>(scalars: I, points: J) -> Self::Pointwhere
I: IntoIterator,
<I as IntoIterator>::Item: Borrow<Scalar>,
J: IntoIterator,
<J as IntoIterator>::Item: Borrow<Self::Point>,
Self::Point: Clone,
fn vartime_multiscalar_mul<I, J>(scalars: I, points: J) -> Self::Pointwhere
I: IntoIterator,
<I as IntoIterator>::Item: Borrow<Scalar>,
J: IntoIterator,
<J as IntoIterator>::Item: Borrow<Self::Point>,
Self::Point: Clone,
Source§impl Zeroize for RistrettoPoint
impl Zeroize for RistrettoPoint
impl Copy for RistrettoPoint
impl Eq for RistrettoPoint
impl PrimeGroup for RistrettoPoint
Auto Trait Implementations§
impl Freeze for RistrettoPoint
impl RefUnwindSafe for RistrettoPoint
impl Send for RistrettoPoint
impl Sync for RistrettoPoint
impl Unpin for RistrettoPoint
impl UnwindSafe for RistrettoPoint
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,
Source§impl<T> ConditionallyNegatable for T
impl<T> ConditionallyNegatable for T
Source§fn conditional_negate(&mut self, choice: Choice)
fn conditional_negate(&mut self, choice: Choice)
Source§impl<T> FmtForward for T
impl<T> FmtForward for T
Source§fn fmt_binary(self) -> FmtBinary<Self>where
Self: Binary,
fn fmt_binary(self) -> FmtBinary<Self>where
Self: Binary,
self
to use its Binary
implementation when Debug
-formatted.Source§fn fmt_display(self) -> FmtDisplay<Self>where
Self: Display,
fn fmt_display(self) -> FmtDisplay<Self>where
Self: Display,
self
to use its Display
implementation when
Debug
-formatted.Source§fn fmt_lower_exp(self) -> FmtLowerExp<Self>where
Self: LowerExp,
fn fmt_lower_exp(self) -> FmtLowerExp<Self>where
Self: LowerExp,
self
to use its LowerExp
implementation when
Debug
-formatted.Source§fn fmt_lower_hex(self) -> FmtLowerHex<Self>where
Self: LowerHex,
fn fmt_lower_hex(self) -> FmtLowerHex<Self>where
Self: LowerHex,
self
to use its LowerHex
implementation when
Debug
-formatted.Source§fn fmt_octal(self) -> FmtOctal<Self>where
Self: Octal,
fn fmt_octal(self) -> FmtOctal<Self>where
Self: Octal,
self
to use its Octal
implementation when Debug
-formatted.Source§fn fmt_pointer(self) -> FmtPointer<Self>where
Self: Pointer,
fn fmt_pointer(self) -> FmtPointer<Self>where
Self: Pointer,
self
to use its Pointer
implementation when
Debug
-formatted.Source§fn fmt_upper_exp(self) -> FmtUpperExp<Self>where
Self: UpperExp,
fn fmt_upper_exp(self) -> FmtUpperExp<Self>where
Self: UpperExp,
self
to use its UpperExp
implementation when
Debug
-formatted.Source§fn fmt_upper_hex(self) -> FmtUpperHex<Self>where
Self: UpperHex,
fn fmt_upper_hex(self) -> FmtUpperHex<Self>where
Self: UpperHex,
self
to use its UpperHex
implementation when
Debug
-formatted.Source§impl<T> IsIdentity for Twhere
T: ConstantTimeEq + Identity,
impl<T> IsIdentity for Twhere
T: ConstantTimeEq + Identity,
Source§fn is_identity(&self) -> bool
fn is_identity(&self) -> bool
Source§impl<T> Pipe for Twhere
T: ?Sized,
impl<T> Pipe for Twhere
T: ?Sized,
Source§fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> Rwhere
Self: Sized,
fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> Rwhere
Self: Sized,
Source§fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> Rwhere
R: 'a,
fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> Rwhere
R: 'a,
self
and passes that borrow into the pipe function. Read moreSource§fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> Rwhere
R: 'a,
fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> Rwhere
R: 'a,
self
and passes that borrow into the pipe function. Read moreSource§fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> R
fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> R
Source§fn pipe_borrow_mut<'a, B, R>(
&'a mut self,
func: impl FnOnce(&'a mut B) -> R,
) -> R
fn pipe_borrow_mut<'a, B, R>( &'a mut self, func: impl FnOnce(&'a mut B) -> R, ) -> R
Source§fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> R
fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> R
self
, then passes self.as_ref()
into the pipe function.Source§fn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> R
fn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> R
self
, then passes self.as_mut()
into the pipe
function.Source§fn pipe_deref<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> R
fn pipe_deref<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> R
self
, then passes self.deref()
into the pipe function.Source§impl<T> Tap for T
impl<T> Tap for T
Source§fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Self
fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Self
Borrow<B>
of a value. Read moreSource§fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Self
fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Self
BorrowMut<B>
of a value. Read moreSource§fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Self
fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Self
AsRef<R>
view of a value. Read moreSource§fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Self
fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Self
AsMut<R>
view of a value. Read moreSource§fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Self
fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Self
Deref::Target
of a value. Read moreSource§fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Self
fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Self
Deref::Target
of a value. Read moreSource§fn tap_dbg(self, func: impl FnOnce(&Self)) -> Self
fn tap_dbg(self, func: impl FnOnce(&Self)) -> Self
.tap()
only in debug builds, and is erased in release builds.Source§fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self
fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self
.tap_mut()
only in debug builds, and is erased in release
builds.Source§fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Self
fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Self
.tap_borrow()
only in debug builds, and is erased in release
builds.Source§fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Self
fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Self
.tap_borrow_mut()
only in debug builds, and is erased in release
builds.Source§fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Self
fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Self
.tap_ref()
only in debug builds, and is erased in release
builds.Source§fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Self
fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Self
.tap_ref_mut()
only in debug builds, and is erased in release
builds.Source§fn tap_deref_dbg<T>(self, func: impl FnOnce(&T)) -> Self
fn tap_deref_dbg<T>(self, func: impl FnOnce(&T)) -> Self
.tap_deref()
only in debug builds, and is erased in release
builds.