Skip to main content

Array

Struct Array 

Source
pub struct Array<T: Element, D: Dimension> { /* private fields */ }
Expand description

An owned, heap-allocated N-dimensional array.

This is the primary array type in ferray — analogous to numpy.ndarray with full ownership of its data buffer.

T is the element type (must implement Element) and D describes the dimensionality (Ix1, Ix2, …, IxDyn).

Implementations§

Source§

impl<T: Element, D: Dimension> Array<T, D>

Source

pub fn broadcast_to( &self, target_shape: &[usize], ) -> FerrayResult<ArrayView<'_, T, IxDyn>>

Broadcast this array to the given shape, returning a dynamic-rank view.

Uses stride-0 tricks for virtual expansion — no data is copied.

§Errors

Returns FerrayError::BroadcastFailure if the array cannot be broadcast to the target shape.

Source§

impl<T: Element, D: Dimension> Array<T, D>

Source

pub fn add_promoted<U>( &self, other: &Array<U, D>, ) -> FerrayResult<Array<<T as Promoted<U>>::Output, D>>
where U: Element + PromoteTo<<T as Promoted<U>>::Output>, T: Promoted<U> + PromoteTo<<T as Promoted<U>>::Output>, <T as Promoted<U>>::Output: Element + Add<Output = <T as Promoted<U>>::Output>,

Add two arrays after promoting both to their common type.

This is the explicit way to perform mixed-type addition (REQ-24). Implicit mixed-type + does not compile.

Source

pub fn sub_promoted<U>( &self, other: &Array<U, D>, ) -> FerrayResult<Array<<T as Promoted<U>>::Output, D>>
where U: Element + PromoteTo<<T as Promoted<U>>::Output>, T: Promoted<U> + PromoteTo<<T as Promoted<U>>::Output>, <T as Promoted<U>>::Output: Element + Sub<Output = <T as Promoted<U>>::Output>,

Subtract two arrays after promoting both to their common type.

Source

pub fn mul_promoted<U>( &self, other: &Array<U, D>, ) -> FerrayResult<Array<<T as Promoted<U>>::Output, D>>
where U: Element + PromoteTo<<T as Promoted<U>>::Output>, T: Promoted<U> + PromoteTo<<T as Promoted<U>>::Output>, <T as Promoted<U>>::Output: Element + Mul<Output = <T as Promoted<U>>::Output>,

Multiply two arrays after promoting both to their common type.

Source

pub fn div_promoted<U>( &self, other: &Array<U, D>, ) -> FerrayResult<Array<<T as Promoted<U>>::Output, D>>
where U: Element + PromoteTo<<T as Promoted<U>>::Output>, T: Promoted<U> + PromoteTo<<T as Promoted<U>>::Output>, <T as Promoted<U>>::Output: Element + Div<Output = <T as Promoted<U>>::Output>,

Divide two arrays after promoting both to their common type.

Source§

impl<T: Element, D: Dimension> Array<T, D>

Source

pub fn itemsize(&self) -> usize

Size in bytes of a single element.

Source

pub fn nbytes(&self) -> usize

Total size in bytes of all elements (size * itemsize).

Source

pub fn dtype(&self) -> DType

Runtime dtype tag for this array’s element type.

Source

pub fn t(&self) -> ArrayView<'_, T, D>

Transposed view (zero-copy). Reverses the axes.

This is the equivalent of NumPy’s .T property.

Source

pub fn copy(&self) -> Self

Deep copy of this array.

Source

pub fn to_vec_flat(&self) -> Vec<T>

Convert to a flat Vec<T> in logical (row-major) order.

Source

pub fn to_bytes(&self) -> FerrayResult<&[u8]>

Return the raw bytes of the array data.

Only succeeds if the array is contiguous; returns an error otherwise.

Source

pub fn flags(&self) -> ArrayFlags

Return flags describing memory properties.

Source§

impl<T: Element, D: Dimension> Array<T, D>

Source

pub fn iter(&self) -> impl Iterator<Item = &T> + '_

Iterate over all elements in logical (row-major) order.

Source

pub fn iter_mut(&mut self) -> impl Iterator<Item = &mut T> + '_

Mutably iterate over all elements in logical order.

Source

pub fn indexed_iter(&self) -> impl Iterator<Item = (Vec<usize>, &T)> + '_

Iterate with multi-dimensional indices.

Yields (Vec<usize>, &T) pairs in logical order. The index vector has one entry per dimension.

Source

pub fn flat(&self) -> impl Iterator<Item = &T> + '_

Flat iterator — same as iter() but emphasises logical-order traversal.

Source

pub fn lanes( &self, axis: Axis, ) -> FerrayResult<impl Iterator<Item = ArrayView<'_, T, Ix1>> + '_>

Iterate over lanes (1-D slices) along the given axis.

For a 2-D array with axis=1, this yields each row. For axis=0, this yields each column.

§Errors

Returns FerrayError::AxisOutOfBounds if axis >= ndim.

Source

pub fn axis_iter( &self, axis: Axis, ) -> FerrayResult<impl Iterator<Item = ArrayView<'_, T, IxDyn>> + '_>

Iterate over sub-arrays along the given axis.

For a 3-D array with shape [2,3,4] and axis=0, this yields two 2-D views each of shape [3,4].

§Errors

Returns FerrayError::AxisOutOfBounds if axis >= ndim.

Source

pub fn axis_iter_mut( &mut self, axis: Axis, ) -> FerrayResult<impl Iterator<Item = ArrayViewMut<'_, T, IxDyn>> + '_>

Mutably iterate over sub-arrays along the given axis.

§Errors

Returns FerrayError::AxisOutOfBounds if axis >= ndim.

Source§

impl<T: Element, D: Dimension> Array<T, D>

Source

pub fn mapv(&self, f: impl Fn(T) -> T) -> Self

Apply a closure to every element, returning a new array.

The closure receives each element by value (cloned) and must return the same type. For type-changing maps, collect via iterators.

Source

pub fn mapv_inplace(&mut self, f: impl Fn(T) -> T)

Apply a closure to every element in place.

Source

pub fn zip_mut_with( &mut self, other: &Array<T, D>, f: impl Fn(&mut T, &T), ) -> FerrayResult<()>

Zip this array mutably with another array of the same shape, applying a closure to each pair of elements.

The closure receives (&mut T, &T) — the first element is from self and can be modified, the second is from other.

§Errors

Returns FerrayError::ShapeMismatch if shapes differ.

Source

pub fn fold_axis( &self, axis: Axis, init: T, fold: impl FnMut(&T, &T) -> T, ) -> FerrayResult<Array<T, IxDyn>>

Fold (reduce) along the given axis.

init provides the initial accumulator value for each lane. The closure receives (accumulator, &element) and must return the new accumulator.

Returns an array with one fewer dimension (the folded axis removed). The result is always returned as a dynamic-rank array.

§Errors

Returns FerrayError::AxisOutOfBounds if axis >= ndim.

Source

pub fn map_to<U: Element>(&self, f: impl Fn(T) -> U) -> Array<U, D>

Apply a closure elementwise, producing an array of a different type.

Unlike mapv which preserves the element type, this allows mapping to a different Element type.

Source§

impl<T: Element, D: Dimension> Array<T, D>

Source

pub fn from_elem(dim: D, elem: T) -> FerrayResult<Self>

Create a new array filled with the given value.

§Errors

Returns FerrayError::InvalidValue if the shape has zero dimensions but D is a fixed-rank type with nonzero rank, or vice versa.

Source

pub fn zeros(dim: D) -> FerrayResult<Self>

Create a new array filled with zeros.

Source

pub fn ones(dim: D) -> FerrayResult<Self>

Create a new array filled with ones.

Source

pub fn from_vec(dim: D, data: Vec<T>) -> FerrayResult<Self>

Create an array from a flat vector and a shape.

§Errors

Returns FerrayError::ShapeMismatch if data.len() does not equal the product of the shape dimensions.

Source

pub fn from_vec_f(dim: D, data: Vec<T>) -> FerrayResult<Self>

Create an array from a flat vector with Fortran (column-major) layout.

§Errors

Returns FerrayError::ShapeMismatch if lengths don’t match.

Source

pub fn from_iter_1d(iter: impl IntoIterator<Item = T>) -> FerrayResult<Self>
where D: Dimension<NdarrayDim = Ix1>,

Create a 1-D array from an iterator.

This only makes sense for D = Ix1; for other dimensions, collect first and use from_vec.

Source

pub fn layout(&self) -> MemoryLayout

Return the memory layout of this array.

Source

pub fn ndim(&self) -> usize

Number of dimensions.

Source

pub fn shape(&self) -> &[usize]

Shape as a slice.

Source

pub fn strides(&self) -> &[isize]

Strides as a slice (in units of elements, not bytes).

Source

pub fn size(&self) -> usize

Total number of elements.

Source

pub fn is_empty(&self) -> bool

Whether the array has zero elements.

Source

pub fn as_ptr(&self) -> *const T

Return a raw pointer to the first element.

Source

pub fn as_mut_ptr(&mut self) -> *mut T

Return a mutable raw pointer to the first element.

Source

pub fn as_slice(&self) -> Option<&[T]>

Return the data as a contiguous slice, if the layout allows it.

Source

pub fn as_slice_mut(&mut self) -> Option<&mut [T]>

Return the data as a contiguous mutable slice, if the layout allows it.

Source

pub fn dim(&self) -> &D

Return a reference to the internal dimension descriptor.

Source§

impl<T: Element, D: Dimension> Array<T, D>

Source

pub fn view(&self) -> ArrayView<'_, T, D>

Create an immutable view of this array.

Source§

impl<T: Element, D: Dimension> Array<T, D>

Source

pub fn view_mut(&mut self) -> ArrayViewMut<'_, T, D>

Create a mutable view of this array.

Source§

impl<T: Element, D: Dimension> Array<T, D>

Source

pub fn index_select( &self, axis: Axis, indices: &[isize], ) -> FerrayResult<Array<T, IxDyn>>

Select elements along an axis using an array of indices.

This is advanced (fancy) indexing — it always returns a copy. The result has the same number of dimensions as the input, but the size along axis is replaced by indices.len().

Negative indices are supported (counting from end).

§Errors
  • AxisOutOfBounds if axis >= ndim
  • IndexOutOfBounds if any index is out of range
Source

pub fn boolean_index( &self, mask: &Array<bool, D>, ) -> FerrayResult<Array<T, Ix1>>

Select elements using a boolean mask.

Returns a 1-D array containing elements where mask is true. This is always a copy.

The mask must be broadcastable to the array’s shape, or have the same total number of elements. When the mask is 1-D and the array is N-D, the mask is applied to the flattened array.

§Errors
  • ShapeMismatch if mask shape is incompatible
Source

pub fn boolean_index_flat( &self, mask: &Array<bool, Ix1>, ) -> FerrayResult<Array<T, Ix1>>

Boolean indexing with a flat mask (1-D mask on N-D array).

The mask is applied to the flattened (row-major) array.

§Errors
  • ShapeMismatch if mask.len() != self.size()
Source

pub fn boolean_index_assign( &mut self, mask: &Array<bool, D>, value: T, ) -> FerrayResult<()>

Assign a scalar value to elements selected by a boolean mask.

Equivalent to a[mask] = value in NumPy.

§Errors
  • ShapeMismatch if mask shape differs from array shape
Source

pub fn boolean_index_assign_array( &mut self, mask: &Array<bool, D>, values: &Array<T, Ix1>, ) -> FerrayResult<()>

Assign values from an array to elements selected by a boolean mask.

values must have exactly as many elements as mask has true entries.

§Errors
  • ShapeMismatch if mask shape differs or values length mismatches
Source§

impl<T: Element, D: Dimension> Array<T, D>

Source

pub fn index_axis( &self, axis: Axis, index: isize, ) -> FerrayResult<ArrayView<'_, T, IxDyn>>

Index into the array along a given axis, removing that axis.

Equivalent to a[i] for axis 0, or a[:, i] for axis 1, etc. Returns a view with one fewer dimension (dynamic-rank).

§Errors
  • AxisOutOfBounds if axis >= ndim
  • IndexOutOfBounds if index is out of range (supports negative)
Source

pub fn slice_axis( &self, axis: Axis, spec: SliceSpec, ) -> FerrayResult<ArrayView<'_, T, IxDyn>>

Slice the array along a given axis, returning a view.

The returned view shares data with the source (zero-copy).

§Errors
  • AxisOutOfBounds if axis >= ndim
  • InvalidValue if step is zero
Source

pub fn slice_axis_mut( &mut self, axis: Axis, spec: SliceSpec, ) -> FerrayResult<ArrayViewMut<'_, T, IxDyn>>

Slice the array along a given axis, returning a mutable view.

§Errors

Same as slice_axis.

Source

pub fn slice_multi( &self, specs: &[SliceSpec], ) -> FerrayResult<ArrayView<'_, T, IxDyn>>

Multi-axis slicing: apply a slice specification to each axis.

specs must have length equal to ndim(). For axes you don’t want to slice, pass SliceSpec::full().

§Errors
  • InvalidValue if specs.len() != ndim()
  • Any errors from individual axis slicing
Source

pub fn insert_axis(&self, axis: Axis) -> FerrayResult<ArrayView<'_, T, IxDyn>>

Insert a new axis of length 1 at the given position.

This is equivalent to np.expand_dims or np.newaxis. Returns a dynamic-rank view with one more dimension.

§Errors
  • AxisOutOfBounds if axis > ndim
Source

pub fn remove_axis(&self, axis: Axis) -> FerrayResult<ArrayView<'_, T, IxDyn>>

Remove an axis of length 1.

This is equivalent to np.squeeze for a single axis. Returns a dynamic-rank view with one fewer dimension.

§Errors
  • AxisOutOfBounds if axis >= ndim
  • InvalidValue if the axis has size != 1
Source

pub fn flat_index(&self, index: isize) -> FerrayResult<&T>

Index into the array with a flat (linear) index.

Elements are ordered in row-major (C) order.

§Errors

Returns IndexOutOfBounds if the index is out of range.

Source

pub fn get(&self, indices: &[isize]) -> FerrayResult<&T>

Get a reference to a single element by multi-dimensional index.

Supports negative indices (counting from end).

§Errors
  • InvalidValue if indices.len() != ndim()
  • IndexOutOfBounds if any index is out of range
Source

pub fn get_mut(&mut self, indices: &[isize]) -> FerrayResult<&mut T>

Get a mutable reference to a single element by multi-dimensional index.

§Errors

Same as get.

Source§

impl<T: Element, D: Dimension> Array<T, D>

Source

pub fn put(&mut self, indices: &[isize], values: &[T]) -> FerrayResult<()>

Put values into the flattened array at the given indices.

Equivalent to np.put(a, ind, v). Modifies the array in-place. Indices refer to the flattened (row-major) array. Values are cycled if fewer than indices.

§Errors
  • IndexOutOfBounds if any index is out of range
  • InvalidValue if values is empty
Source

pub fn put_along_axis( &mut self, indices: &[isize], values: &Array<T, IxDyn>, axis: Axis, ) -> FerrayResult<()>

Put values along an axis at specified indices.

For each index position along axis, assigns the values from the corresponding sub-array of values.

§Errors
  • AxisOutOfBounds if axis >= ndim
  • IndexOutOfBounds if any index is out of range
Source

pub fn fill_diagonal(&mut self, val: T)

Fill the main diagonal of a 2-D (or N-D) array with a value.

For N-D arrays, the diagonal consists of indices where all index values are equal: a[i, i, ..., i].

Equivalent to np.fill_diagonal(a, val).

Trait Implementations§

Source§

impl<T: Element, D: Dimension> AsRawBuffer for Array<T, D>

Source§

fn raw_ptr(&self) -> *const u8

Raw pointer to the first element.
Source§

fn raw_shape(&self) -> &[usize]

Shape as a slice of dimension sizes.
Source§

fn raw_strides_bytes(&self) -> Vec<isize>

Strides in bytes (not elements).
Source§

fn raw_dtype(&self) -> DType

Runtime dtype descriptor.
Source§

fn is_c_contiguous(&self) -> bool

Whether the data is C-contiguous.
Source§

fn is_f_contiguous(&self) -> bool

Whether the data is Fortran-contiguous.
Source§

impl<T: Element, D: Dimension> AsType<D> for Array<T, D>

Available on non-crate feature no_std only.
Source§

fn astype<U: Element>(&self) -> FerrayResult<Array<U, D>>
where Self: AsTypeInner<U, D>,

Cast all elements to type U, returning a new array. Read more
Source§

impl<T, U, D> AsTypeInner<U, D> for Array<T, D>
where T: Element + PromoteTo<U>, U: Element, D: Dimension,

Available on non-crate feature no_std only.

Blanket implementation: any T that can PromoteTo can astype.

Source§

fn astype_inner(&self) -> FerrayResult<Array<U, D>>

Perform the cast.
Source§

impl<T: Element, D: Dimension> Clone for Array<T, D>

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<T: Element, D: Dimension> Debug for Array<T, D>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<T: Element, D: Dimension> Display for Array<T, D>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl From<Array<Complex<f32>, IxDyn>> for DynArray

Source§

fn from(a: Array<Complex<f32>, IxDyn>) -> Self

Converts to this type from the input type.
Source§

impl From<Array<Complex<f64>, IxDyn>> for DynArray

Source§

fn from(a: Array<Complex<f64>, IxDyn>) -> Self

Converts to this type from the input type.
Source§

impl<T: Element, D: Dimension> From<Array<T, D>> for ArcArray<T, D>

Source§

fn from(arr: Array<T, D>) -> Self

Converts to this type from the input type.
Source§

impl<T: Element, D: Dimension> From<Array<T, D>> for Array<T, D::NdarrayDim>

Source§

fn from(arr: Array<T, D>) -> Self

Converts to this type from the input type.
Source§

impl<T: Element, D: Dimension> From<Array<T, D>> for CowArray<'_, T, D>

Source§

fn from(arr: Array<T, D>) -> Self

Converts to this type from the input type.
Source§

impl From<Array<bool, IxDyn>> for DynArray

Source§

fn from(a: Array<bool, IxDyn>) -> Self

Converts to this type from the input type.
Source§

impl From<Array<f32, IxDyn>> for DynArray

Source§

fn from(a: Array<f32, IxDyn>) -> Self

Converts to this type from the input type.
Source§

impl From<Array<f64, IxDyn>> for DynArray

Source§

fn from(a: Array<f64, IxDyn>) -> Self

Converts to this type from the input type.
Source§

impl From<Array<i128, IxDyn>> for DynArray

Source§

fn from(a: Array<i128, IxDyn>) -> Self

Converts to this type from the input type.
Source§

impl From<Array<i16, IxDyn>> for DynArray

Source§

fn from(a: Array<i16, IxDyn>) -> Self

Converts to this type from the input type.
Source§

impl From<Array<i32, IxDyn>> for DynArray

Source§

fn from(a: Array<i32, IxDyn>) -> Self

Converts to this type from the input type.
Source§

impl From<Array<i64, IxDyn>> for DynArray

Source§

fn from(a: Array<i64, IxDyn>) -> Self

Converts to this type from the input type.
Source§

impl From<Array<i8, IxDyn>> for DynArray

Source§

fn from(a: Array<i8, IxDyn>) -> Self

Converts to this type from the input type.
Source§

impl From<Array<u128, IxDyn>> for DynArray

Source§

fn from(a: Array<u128, IxDyn>) -> Self

Converts to this type from the input type.
Source§

impl From<Array<u16, IxDyn>> for DynArray

Source§

fn from(a: Array<u16, IxDyn>) -> Self

Converts to this type from the input type.
Source§

impl From<Array<u32, IxDyn>> for DynArray

Source§

fn from(a: Array<u32, IxDyn>) -> Self

Converts to this type from the input type.
Source§

impl From<Array<u64, IxDyn>> for DynArray

Source§

fn from(a: Array<u64, IxDyn>) -> Self

Converts to this type from the input type.
Source§

impl From<Array<u8, IxDyn>> for DynArray

Source§

fn from(a: Array<u8, IxDyn>) -> Self

Converts to this type from the input type.
Source§

impl<T: Element, D: Dimension> From<ArrayBase<OwnedRepr<T>, <D as Dimension>::NdarrayDim>> for Array<T, D>

Source§

fn from(inner: Array<T, D::NdarrayDim>) -> Self

Converts to this type from the input type.
Source§

impl<'a, T: Element, D: Dimension> IntoIterator for &'a Array<T, D>

Source§

type Item = &'a T

The type of the elements being iterated over.
Source§

type IntoIter = Iter<'a, T, <D as Dimension>::NdarrayDim>

Which kind of iterator are we turning this into?
Source§

fn into_iter(self) -> Self::IntoIter

Creates an iterator from a value. Read more
Source§

impl<'a, T: Element, D: Dimension> IntoIterator for &'a mut Array<T, D>

Source§

type Item = &'a mut T

The type of the elements being iterated over.
Source§

type IntoIter = IterMut<'a, T, <D as Dimension>::NdarrayDim>

Which kind of iterator are we turning this into?
Source§

fn into_iter(self) -> Self::IntoIter

Creates an iterator from a value. Read more
Source§

impl<T: Element, D: Dimension> IntoIterator for Array<T, D>

Source§

type Item = T

The type of the elements being iterated over.
Source§

type IntoIter = IntoIter<T, <D as Dimension>::NdarrayDim>

Which kind of iterator are we turning this into?
Source§

fn into_iter(self) -> Self::IntoIter

Creates an iterator from a value. Read more
Source§

impl<T: Element + PartialEq, D: Dimension> PartialEq for Array<T, D>

Source§

fn eq(&self, other: &Self) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl<T: Element + Eq, D: Dimension> Eq for Array<T, D>

Auto Trait Implementations§

§

impl<T, D> Freeze for Array<T, D>
where D: Freeze, <D as Dimension>::NdarrayDim: Freeze,

§

impl<T, D> RefUnwindSafe for Array<T, D>

§

impl<T, D> Send for Array<T, D>

§

impl<T, D> Sync for Array<T, D>

§

impl<T, D> Unpin for Array<T, D>
where D: Unpin, <D as Dimension>::NdarrayDim: Unpin,

§

impl<T, D> UnsafeUnpin for Array<T, D>

§

impl<T, D> UnwindSafe for Array<T, D>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.