pub struct Matrix<T> { /* private fields */ }Expand description
A 2D matrix with row-major storage
Data is stored in row-major format (C-style), where consecutive elements in memory belong to the same row. This is compatible with NumPy’s default layout and optimal for cache locality when accessing rows.
§Storage Layout
For a 2x3 matrix:
[[a, b, c],
[d, e, f]]Data is stored as: [a, b, c, d, e, f]
§Example
use trueno::Matrix;
let m = Matrix::from_vec(2, 2, vec![1.0, 2.0, 3.0, 4.0]).unwrap();
assert_eq!(m.get(0, 0), Some(&1.0));
assert_eq!(m.get(0, 1), Some(&2.0));
assert_eq!(m.get(1, 0), Some(&3.0));
assert_eq!(m.get(1, 1), Some(&4.0));Implementations§
Source§impl Matrix<f32>
impl Matrix<f32>
Sourcepub fn matmul(&self, other: &Matrix<f32>) -> Result<Matrix<f32>, TruenoError>
pub fn matmul(&self, other: &Matrix<f32>) -> Result<Matrix<f32>, TruenoError>
Matrix multiplication (matmul)
Computes C = A × B where A is m×n, B is n×p, and C is m×p.
§Arguments
other- The matrix to multiply with (right operand)
§Returns
A new matrix containing the result of matrix multiplication
§Errors
Returns InvalidInput if matrix dimensions are incompatible
(i.e., self.cols != other.rows)
§Example
use trueno::Matrix;
let a = Matrix::from_vec(2, 2, vec![1.0, 2.0, 3.0, 4.0]).unwrap();
let b = Matrix::from_vec(2, 2, vec![5.0, 6.0, 7.0, 8.0]).unwrap();
let c = a.matmul(&b).unwrap();
// [[1, 2], [[5, 6], [[19, 22],
// [3, 4]] × [7, 8]] = [43, 50]]
assert_eq!(c.get(0, 0), Some(&19.0));
assert_eq!(c.get(0, 1), Some(&22.0));
assert_eq!(c.get(1, 0), Some(&43.0));
assert_eq!(c.get(1, 1), Some(&50.0));Source§impl Matrix<f32>
impl Matrix<f32>
Sourcepub fn transpose(&self) -> Matrix<f32>
pub fn transpose(&self) -> Matrix<f32>
Transpose this matrix (swap rows and columns)
Returns a new matrix with dimensions swapped: self.rows → result.cols,
self.cols → result.rows.
§Performance
Uses cache-optimized block-wise transpose with 32x32 blocks. Sequential writes for output ensure good cache behavior.
§Example
use trueno::Matrix;
let m = Matrix::from_vec(2, 3, vec![1.0, 2.0, 3.0, 4.0, 5.0, 6.0]).unwrap();
let t = m.transpose();
// [[1, 2, 3], [[1, 4],
// [4, 5, 6]] → [2, 5],
// [3, 6]]
assert_eq!(t.rows(), 3);
assert_eq!(t.cols(), 2);
assert_eq!(t.get(0, 0), Some(&1.0));
assert_eq!(t.get(0, 1), Some(&4.0));
assert_eq!(t.get(1, 0), Some(&2.0));Sourcepub fn matvec(&self, v: &Vector<f32>) -> Result<Vector<f32>, TruenoError>
pub fn matvec(&self, v: &Vector<f32>) -> Result<Vector<f32>, TruenoError>
Matrix-vector multiplication (column vector): A × v
Multiplies this matrix by a column vector, computing A × v where the result
is a column vector with length equal to the number of rows in A.
§Mathematical Definition
For an m×n matrix A and an n-dimensional vector v:
result[i] = Σ(j=0 to n-1) A[i,j] × v[j]§Arguments
v- Column vector with length equal toself.cols()
§Returns
A new vector with length self.rows()
§Errors
Returns InvalidInput if v.len() != self.cols()
§Example
use trueno::{Matrix, Vector};
let m = Matrix::from_vec(2, 3, vec![1.0, 2.0, 3.0, 4.0, 5.0, 6.0]).unwrap();
let v = Vector::from_slice(&[1.0, 2.0, 3.0]);
let result = m.matvec(&v).unwrap();
// [[1, 2, 3] [1] [1×1 + 2×2 + 3×3] [14]
// [4, 5, 6]] × [2] = [4×1 + 5×2 + 6×3] = [32]
// [3]
assert_eq!(result.as_slice(), &[14.0, 32.0]);Sourcepub fn vecmat(
v: &Vector<f32>,
m: &Matrix<f32>,
) -> Result<Vector<f32>, TruenoError>
pub fn vecmat( v: &Vector<f32>, m: &Matrix<f32>, ) -> Result<Vector<f32>, TruenoError>
Vector-matrix multiplication (row vector): v^T × A
Multiplies a row vector by this matrix, computing v^T × A where the result
is a row vector with length equal to the number of columns in A.
§Mathematical Definition
For an m-dimensional vector v and an m×n matrix A:
result[j] = Σ(i=0 to m-1) v[i] × A[i,j]§Arguments
v- Row vector with length equal tom.rows()m- Matrix to multiply
§Returns
A new vector with length m.cols()
§Errors
Returns InvalidInput if v.len() != m.rows()
§Example
use trueno::{Matrix, Vector};
let m = Matrix::from_vec(2, 3, vec![1.0, 2.0, 3.0, 4.0, 5.0, 6.0]).unwrap();
let v = Vector::from_slice(&[1.0, 2.0]);
let result = Matrix::vecmat(&v, &m).unwrap();
// [1, 2] × [[1, 2, 3] = [1×1 + 2×4, 1×2 + 2×5, 1×3 + 2×6]
// [4, 5, 6]]
// = [9, 12, 15]
assert_eq!(result.as_slice(), &[9.0, 12.0, 15.0]);Source§impl Matrix<f32>
impl Matrix<f32>
Sourcepub fn convolve2d(
&self,
kernel: &Matrix<f32>,
) -> Result<Matrix<f32>, TruenoError>
pub fn convolve2d( &self, kernel: &Matrix<f32>, ) -> Result<Matrix<f32>, TruenoError>
Perform 2D convolution with a kernel
Applies a 2D convolution operation using “valid” padding (no padding), resulting in an output smaller than the input.
§Arguments
kernel- Convolution kernel (filter) to apply
§Returns
Convolved matrix with dimensions:
- rows:
input.rows - kernel.rows + 1 - cols:
input.cols - kernel.cols + 1
§Errors
Returns InvalidInput if:
- Kernel is larger than input in any dimension
§Example
use trueno::Matrix;
// 5x5 input image
let input = Matrix::from_vec(
5, 5,
vec![
0.0, 0.0, 0.0, 0.0, 0.0,
0.0, 0.0, 0.0, 0.0, 0.0,
0.0, 0.0, 9.0, 0.0, 0.0,
0.0, 0.0, 0.0, 0.0, 0.0,
0.0, 0.0, 0.0, 0.0, 0.0,
]
)?;
// 3x3 averaging kernel
let kernel_val = 1.0 / 9.0;
let kernel = Matrix::from_vec(
3, 3,
vec![kernel_val; 9]
)?;
let result = input.convolve2d(&kernel)?;
assert_eq!(result.rows(), 3); // 5 - 3 + 1
assert_eq!(result.cols(), 3);Source§impl Matrix<f32>
impl Matrix<f32>
Sourcepub fn max_pool2d(
&self,
kernel: (usize, usize),
stride: (usize, usize),
) -> Result<Matrix<f32>, TruenoError>
pub fn max_pool2d( &self, kernel: (usize, usize), stride: (usize, usize), ) -> Result<Matrix<f32>, TruenoError>
2D Max Pooling operation for CNN downsampling
Applies max pooling over a 2D input tensor with specified kernel size and stride.
§Arguments
kernel- (kernel_height, kernel_width) pooling window sizestride- (stride_height, stride_width) step size
§Examples
use trueno::matrix::Matrix;
let input = Matrix::from_vec(4, 4, vec![
1.0, 2.0, 3.0, 4.0,
5.0, 6.0, 7.0, 8.0,
9.0, 10.0, 11.0, 12.0,
13.0, 14.0, 15.0, 16.0,
])?;
let pooled = input.max_pool2d((2, 2), (2, 2))?;
assert_eq!(pooled.shape(), (2, 2));
assert_eq!(pooled.get(0, 0), Some(&6.0)); // max of [1,2,5,6]
assert_eq!(pooled.get(1, 1), Some(&16.0)); // max of [11,12,15,16]Sourcepub fn avg_pool2d(
&self,
kernel: (usize, usize),
stride: (usize, usize),
) -> Result<Matrix<f32>, TruenoError>
pub fn avg_pool2d( &self, kernel: (usize, usize), stride: (usize, usize), ) -> Result<Matrix<f32>, TruenoError>
2D Average Pooling operation for CNN downsampling
Applies average pooling over a 2D input tensor with specified kernel size and stride.
§Arguments
kernel- (kernel_height, kernel_width) pooling window sizestride- (stride_height, stride_width) step size
§Examples
use trueno::matrix::Matrix;
let input = Matrix::from_vec(4, 4, vec![
1.0, 2.0, 3.0, 4.0,
5.0, 6.0, 7.0, 8.0,
9.0, 10.0, 11.0, 12.0,
13.0, 14.0, 15.0, 16.0,
])?;
let pooled = input.avg_pool2d((2, 2), (2, 2))?;
assert_eq!(pooled.shape(), (2, 2));
assert!((pooled.get(0, 0).unwrap_or(&0.0) - 3.5).abs() < 1e-5); // avg of [1,2,5,6]Source§impl Matrix<f32>
impl Matrix<f32>
Sourcepub fn embedding_lookup(
&self,
indices: &[usize],
) -> Result<Matrix<f32>, TruenoError>
pub fn embedding_lookup( &self, indices: &[usize], ) -> Result<Matrix<f32>, TruenoError>
Lookup embeddings by indices
Performs embedding lookup where self is the embedding table with shape
[vocab_size, embed_dim] and indices specify which rows to select.
§Arguments
indices- Slice of indices into the embedding table
§Returns
A matrix with shape [indices.len(), embed_dim] containing the selected rows
§Errors
Returns InvalidInput if any index is out of bounds
§Example
use trueno::Matrix;
// Create embedding table: 4 words, 3-dimensional embeddings
let embeddings = Matrix::from_vec(4, 3, vec![
1.0, 2.0, 3.0, // word 0
4.0, 5.0, 6.0, // word 1
7.0, 8.0, 9.0, // word 2
10.0, 11.0, 12.0 // word 3
])?;
// Lookup embeddings for indices [1, 3, 0]
let result = embeddings.embedding_lookup(&[1, 3, 0])?;
assert_eq!(result.rows(), 3);
assert_eq!(result.cols(), 3);
assert_eq!(result.get(0, 0), Some(&4.0)); // word 1
assert_eq!(result.get(1, 0), Some(&10.0)); // word 3
assert_eq!(result.get(2, 0), Some(&1.0)); // word 0Sourcepub fn embedding_lookup_sparse(
&self,
indices: &[usize],
) -> Result<(Matrix<f32>, Vec<usize>), TruenoError>
pub fn embedding_lookup_sparse( &self, indices: &[usize], ) -> Result<(Matrix<f32>, Vec<usize>), TruenoError>
Lookup embeddings with gradient tracking support (for training)
Returns both the embeddings and a sparse gradient accumulator. This is useful for sparse gradient updates in training.
§Arguments
indices- Slice of indices into the embedding table
§Returns
Tuple of (embeddings, unique_indices) where unique_indices can be used for sparse gradient updates
§Errors
Returns InvalidInput if any index is out of bounds
Sourcepub fn topk(&self, k: usize) -> Result<(Vec<f32>, Vec<usize>), TruenoError>
pub fn topk(&self, k: usize) -> Result<(Vec<f32>, Vec<usize>), TruenoError>
Top-K selection: returns the k largest elements and their indices
Useful for beam search, sampling, and ranking operations. Searches row-major order and returns (values, indices) sorted descending.
§Examples
use trueno::matrix::Matrix;
let m = Matrix::from_vec(2, 3, vec![1.0, 5.0, 3.0, 2.0, 6.0, 4.0])?;
let (values, indices) = m.topk(2)?;
assert_eq!(values, vec![6.0, 5.0]);
assert_eq!(indices, vec![4, 1]); // flat indicesSourcepub fn gather(
&self,
indices: &[usize],
axis: usize,
) -> Result<Matrix<f32>, TruenoError>
pub fn gather( &self, indices: &[usize], axis: usize, ) -> Result<Matrix<f32>, TruenoError>
Gather elements along axis using indices
For 2D matrix with axis=0: output[i] = self[indices[i], :] For 2D matrix with axis=1: output[:, i] = self[:, indices[i]]
§Examples
use trueno::matrix::Matrix;
let m = Matrix::from_vec(3, 2, vec![1.0, 2.0, 3.0, 4.0, 5.0, 6.0]).unwrap();
let gathered = m.gather(&[2, 0], 0).unwrap(); // Select rows 2 and 0
assert_eq!(gathered.shape(), (2, 2));
assert_eq!(gathered.get(0, 0), Some(&5.0)); // Row 2
assert_eq!(gathered.get(1, 0), Some(&1.0)); // Row 0Sourcepub fn pad(
&self,
padding: ((usize, usize), (usize, usize)),
value: f32,
) -> Result<Matrix<f32>, TruenoError>
pub fn pad( &self, padding: ((usize, usize), (usize, usize)), value: f32, ) -> Result<Matrix<f32>, TruenoError>
Pad matrix with a constant value
§Arguments
padding- ((top, bottom), (left, right)) padding amountsvalue- constant value to pad with (usually 0.0)
§Examples
use trueno::matrix::Matrix;
let m = Matrix::from_vec(2, 2, vec![1.0, 2.0, 3.0, 4.0]).unwrap();
let padded = m.pad(((1, 1), (1, 1)), 0.0).unwrap();
assert_eq!(padded.shape(), (4, 4));
assert_eq!(padded.get(0, 0), Some(&0.0)); // top-left padding
assert_eq!(padded.get(1, 1), Some(&1.0)); // original (0,0)Source§impl Matrix<f32>
impl Matrix<f32>
Sourcepub fn from_vec(
rows: usize,
cols: usize,
data: Vec<f32>,
) -> Result<Self, TruenoError>
pub fn from_vec( rows: usize, cols: usize, data: Vec<f32>, ) -> Result<Self, TruenoError>
Creates a matrix from a vector of data
§Arguments
rows- Number of rowscols- Number of columnsdata- Vector containing matrix elements in row-major order
§Errors
Returns InvalidInput if data.len() != rows * cols
§Example
use trueno::Matrix;
let m = Matrix::from_vec(2, 2, vec![1.0, 2.0, 3.0, 4.0]).unwrap();
assert_eq!(m.rows(), 2);
assert_eq!(m.cols(), 2);Sourcepub fn from_vec_with_backend(
rows: usize,
cols: usize,
data: Vec<f32>,
backend: Backend,
) -> Self
pub fn from_vec_with_backend( rows: usize, cols: usize, data: Vec<f32>, backend: Backend, ) -> Self
Creates a matrix from a vector with a specific backend
This is useful for testing specific SIMD code paths.
Sourcepub fn from_slice(
rows: usize,
cols: usize,
data: &[f32],
) -> Result<Self, TruenoError>
pub fn from_slice( rows: usize, cols: usize, data: &[f32], ) -> Result<Self, TruenoError>
Creates a matrix from a slice by copying the data
This is a convenience method that copies the slice into an owned vector.
For zero-copy scenarios, consider using the data directly with from_vec
if you already have an owned Vec.
§Arguments
rows- Number of rowscols- Number of columnsdata- Slice containing matrix elements in row-major order
§Errors
Returns InvalidInput if data.len() != rows * cols
§Example
use trueno::Matrix;
let data = [1.0, 2.0, 3.0, 4.0];
let m = Matrix::from_slice(2, 2, &data).unwrap();
assert_eq!(m.get(0, 0), Some(&1.0));Sourcepub fn zeros(rows: usize, cols: usize) -> Self
pub fn zeros(rows: usize, cols: usize) -> Self
Creates a matrix filled with zeros
§Example
use trueno::Matrix;
let m = Matrix::zeros(3, 3);
assert_eq!(m.get(1, 1), Some(&0.0));Sourcepub fn identity(n: usize) -> Self
pub fn identity(n: usize) -> Self
Creates an identity matrix (square matrix with 1s on diagonal)
§Example
use trueno::Matrix;
let m = Matrix::identity(3);
assert_eq!(m.get(0, 0), Some(&1.0));
assert_eq!(m.get(0, 1), Some(&0.0));
assert_eq!(m.get(1, 1), Some(&1.0));Sourcepub fn get(&self, row: usize, col: usize) -> Option<&f32>
pub fn get(&self, row: usize, col: usize) -> Option<&f32>
Gets a reference to an element at (row, col)
Returns None if indices are out of bounds
Trait Implementations§
impl<T> StructuralPartialEq for Matrix<T>
Auto Trait Implementations§
impl<T> Freeze for Matrix<T>
impl<T> RefUnwindSafe for Matrix<T>where
T: RefUnwindSafe,
impl<T> Send for Matrix<T>where
T: Send,
impl<T> Sync for Matrix<T>where
T: Sync,
impl<T> Unpin for Matrix<T>where
T: Unpin,
impl<T> UnsafeUnpin for Matrix<T>
impl<T> UnwindSafe for Matrix<T>where
T: 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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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> 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>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§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> Pointable for T
impl<T> Pointable for T
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.