Struct TypedTensorViewMut
pub struct TypedTensorViewMut<'a, T, R = DynRank>where
R: TensorRank,{ /* private fields */ }Expand description
Mutable borrowed view of typed tensor storage with arbitrary strides.
§Examples
use tenferro_tensor::TypedTensorViewMut;
let mut data = [1_i32, 2, 3];
let mut view = TypedTensorViewMut::from_slice(vec![3], vec![-1], 2, &mut data)?;
*view.get_mut(&[2]).unwrap() = 10;
assert_eq!(view.as_read_only().get(&[2]), Some(&10));Implementations§
§impl<'a, T> TypedTensorViewMut<'a, T>where
T: 'static,
impl<'a, T> TypedTensorViewMut<'a, T>where
T: 'static,
pub fn from_col_major(
shape: &[usize],
data: &'a mut [T],
) -> Result<TypedTensorViewMut<'a, T>, Error>
pub fn from_col_major( shape: &[usize], data: &'a mut [T], ) -> Result<TypedTensorViewMut<'a, T>, Error>
Create a mutable dynamic-rank view over compact column-major host data.
§Examples
use tenferro_tensor::TypedTensorViewMut;
let mut data = [1_i32, 2, 3, 4];
let view = TypedTensorViewMut::from_col_major(&[2, 2], &mut data)?;
assert_eq!(view.strides(), &[1, 2]);§Errors
Returns [crate::Error::Validation] with
[tenferro_tensor_core::ValidationError::IntegerOverflow] for compact
shape or offset arithmetic overflow, or
[tenferro_tensor_core::ValidationError::ViewOutOfBounds] when the
compact shape reaches beyond data.
pub fn from_slice(
shape: impl AsRef<[usize]>,
strides: impl AsRef<[isize]>,
offset: isize,
data: &'a mut [T],
) -> Result<TypedTensorViewMut<'a, T>, Error>
pub fn from_slice( shape: impl AsRef<[usize]>, strides: impl AsRef<[isize]>, offset: isize, data: &'a mut [T], ) -> Result<TypedTensorViewMut<'a, T>, Error>
Create a mutable host view from explicit layout metadata.
Layouts where distinct logical elements can alias the same physical element are rejected.
§Examples
use tenferro_tensor::TypedTensorViewMut;
let mut data = [1_i32, 2];
assert!(TypedTensorViewMut::from_slice(vec![2], vec![0], 0, &mut data).is_err());§Errors
Returns [crate::Error::Validation] with
[tenferro_tensor_core::ValidationError::RankMismatch] when shape and
strides have different ranks,
[tenferro_tensor_core::ValidationError::ViewOutOfBounds] when the
layout reaches beyond data,
[tenferro_tensor_core::ValidationError::OverlappingMutableLayout] when
logical elements alias, or
[tenferro_tensor_core::ValidationError::IntegerOverflow] for layout
arithmetic overflow.
§impl<'a, T, R> TypedTensorViewMut<'a, T, R>where
T: 'static,
R: TensorRank,
impl<'a, T, R> TypedTensorViewMut<'a, T, R>where
T: 'static,
R: TensorRank,
pub fn from_slice_ranked(
shape: impl Into<<R as TensorRank>::Shape>,
strides: impl Into<<R as TensorRank>::Strides>,
offset: isize,
data: &'a mut [T],
) -> Result<TypedTensorViewMut<'a, T, R>, Error>
pub fn from_slice_ranked( shape: impl Into<<R as TensorRank>::Shape>, strides: impl Into<<R as TensorRank>::Strides>, offset: isize, data: &'a mut [T], ) -> Result<TypedTensorViewMut<'a, T, R>, Error>
Create a rank-generic mutable host view from explicit layout metadata.
§Examples
use tenferro_tensor::{Rank, TypedTensorViewMut};
let mut data = [1_i32, 2, 3, 4];
let view = TypedTensorViewMut::<_, Rank<2>>::from_slice_ranked([2, 2], [1, 2], 0, &mut data)?;
assert_eq!(view.shape(), &[2, 2]);§Errors
Returns [crate::Error::Validation] with
[tenferro_tensor_core::ValidationError::RankMismatch] when the typed
rank does not match shape or strides,
[tenferro_tensor_core::ValidationError::ViewOutOfBounds] when the
layout reaches beyond data,
[tenferro_tensor_core::ValidationError::OverlappingMutableLayout] when
logical elements alias, or
[tenferro_tensor_core::ValidationError::IntegerOverflow] for layout
arithmetic overflow.
pub fn shape(&self) -> &[usize]
pub fn shape(&self) -> &[usize]
Return the logical shape.
§Examples
use tenferro_tensor::TypedTensorViewMut;
let mut data = [0_i32; 2];
let view = TypedTensorViewMut::from_slice(vec![2], vec![1], 0, &mut data)?;
assert_eq!(view.shape(), &[2]);pub fn strides(&self) -> &[isize]
pub fn strides(&self) -> &[isize]
Return strides in element units.
§Examples
use tenferro_tensor::TypedTensorViewMut;
let mut data = [0_i32; 2];
let view = TypedTensorViewMut::from_slice(vec![2], vec![-1], 1, &mut data)?;
assert_eq!(view.strides(), &[-1]);pub fn offset(&self) -> isize
pub fn offset(&self) -> isize
Return the physical element offset.
§Examples
use tenferro_tensor::TypedTensorViewMut;
let mut data = [1_i32, 2];
let view = TypedTensorViewMut::from_slice(vec![1], vec![1], 1, &mut data)?;
assert_eq!(view.offset(), 1);pub fn host_storage(&self) -> Result<&[T], Error>
pub fn host_storage(&self) -> Result<&[T], Error>
Return the borrowed host storage backing this view.
This exposes the entire backing host allocation, not just the logical
slice covered by this view. Use TypedTensorViewMut::as_read_only
with TypedTensorView::as_slice when the caller needs the contiguous
logical region instead.
§Examples
use tenferro_tensor::TypedTensorViewMut;
let mut data = [1_i32, 2];
let view = TypedTensorViewMut::from_slice(vec![2], vec![1], 0, &mut data)?;
assert_eq!(view.host_storage()?, &[1, 2]);§Errors
Returns [crate::Error::RuntimeState] when this view wraps a backend
buffer; backend storage must be downloaded before host inspection.
pub fn host_storage_mut(&mut self) -> Result<&mut [T], Error>
pub fn host_storage_mut(&mut self) -> Result<&mut [T], Error>
Mutably borrow the host storage backing this view.
This exposes the entire backing host allocation, not just the logical slice covered by this view. Prefer scalar element accessors when mutating a logical region; tensor-sized copies belong to an active backend.
§Examples
use tenferro_tensor::TypedTensorViewMut;
let mut data = [1_i32, 2];
let mut view = TypedTensorViewMut::from_slice(vec![2], vec![1], 0, &mut data)?;
view.host_storage_mut()?[0] = 3;
assert_eq!(view.get(&[0]), Some(&3));§Errors
Returns [crate::Error::RuntimeState] when this view wraps a backend
buffer; backend storage must be downloaded before host inspection.
pub fn n_elements(&self) -> usize
pub fn n_elements(&self) -> usize
Return the number of logical elements in this view.
§Examples
use tenferro_tensor::TypedTensorViewMut;
let mut data = [0_i32; 6];
let view = TypedTensorViewMut::from_slice(vec![2, 3], vec![1, 2], 0, &mut data)?;
assert_eq!(view.n_elements(), 6);pub fn layout(&self) -> &TensorLayout<R>
pub fn layout(&self) -> &TensorLayout<R>
Return layout metadata for this view.
§Examples
use tenferro_tensor::TypedTensorViewMut;
let mut data = [1_i32, 2];
let view = TypedTensorViewMut::from_slice(vec![2], vec![1], 0, &mut data)?;
assert!(view.layout().is_compact_col_major().unwrap());pub fn placement(&self) -> &Placement
pub fn placement(&self) -> &Placement
Return placement metadata for this view.
§Examples
use tenferro_tensor::{MemoryKind, TypedTensorViewMut};
let mut data = [1_i32];
let view = TypedTensorViewMut::from_slice(vec![1], vec![1], 0, &mut data)?;
assert_eq!(view.placement().memory_kind, MemoryKind::UnpinnedHost);pub fn linear_offset(&self, indices: &[usize]) -> Option<usize>
pub fn linear_offset(&self, indices: &[usize]) -> Option<usize>
Compute the physical element offset for a logical index.
§Examples
use tenferro_tensor::TypedTensorViewMut;
let mut data = [1_i32, 2, 3];
let view = TypedTensorViewMut::from_slice(vec![3], vec![-1], 2, &mut data)?;
assert_eq!(view.linear_offset(&[2]), Some(0));pub fn layout_linear_offset(&self, indices: &[usize]) -> Result<usize, Error>
pub fn layout_linear_offset(&self, indices: &[usize]) -> Result<usize, Error>
Compute the physical element offset for a logical index, returning a typed error.
§Examples
use tenferro_tensor::TypedTensorViewMut;
let mut data = [1_i32, 2, 3];
let view = TypedTensorViewMut::from_slice([3], [-1], 2, &mut data)?;
assert_eq!(view.layout_linear_offset(&[2])?, 0);§Errors
Returns [crate::Error::Validation] with
[tenferro_tensor_core::ValidationError::RankMismatch] when indices
has the wrong rank, [tenferro_tensor_core::ValidationError::InvalidArgument]
when an index is outside its axis extent, or
[tenferro_tensor_core::ValidationError::IntegerOverflow] when offset
arithmetic overflows.
pub fn is_col_major_contiguous(&self) -> Result<bool, Error>
pub fn is_col_major_contiguous(&self) -> Result<bool, Error>
Return whether this mutable view is compact column-major.
§Examples
use tenferro_tensor::TypedTensorViewMut;
let mut data = [1_i32, 2];
let view = TypedTensorViewMut::from_slice([2], [1], 0, &mut data)?;
assert!(view.is_col_major_contiguous()?);§Errors
Returns [crate::Error::Validation] with
[tenferro_tensor_core::ValidationError::IntegerOverflow] when
compactness arithmetic overflows.
pub fn layout_summary(&self) -> String
pub fn layout_summary(&self) -> String
Return a compact string summary of this mutable view’s layout metadata.
§Examples
use tenferro_tensor::TypedTensorViewMut;
let mut data = [1_i32, 2];
let view = TypedTensorViewMut::from_slice([2], [1], 0, &mut data)?;
assert!(view.layout_summary().contains("shape=[2]"));pub fn assert_col_major_contiguous(&self) -> Result<(), Error>
pub fn assert_col_major_contiguous(&self) -> Result<(), Error>
Assert this mutable view is compact column-major.
§Examples
use tenferro_tensor::TypedTensorViewMut;
let mut data = [1_i32, 2];
let view = TypedTensorViewMut::from_slice([2], [1], 0, &mut data)?;
view.assert_col_major_contiguous()?;§Errors
Returns [crate::Error::Validation] with
[tenferro_tensor_core::ValidationError::IntegerOverflow] when
compactness arithmetic overflows, or
[tenferro_tensor_core::ValidationError::InvalidArgument] when the
view is not compact column-major.
pub fn get(&self, indices: &[usize]) -> Option<&T>
pub fn get(&self, indices: &[usize]) -> Option<&T>
Borrow one host element by logical index.
§Examples
use tenferro_tensor::TypedTensorViewMut;
let mut data = [1_i32, 2];
let view = TypedTensorViewMut::from_slice(vec![2], vec![1], 0, &mut data)?;
assert_eq!(view.get(&[1]), Some(&2));pub fn get_mut(&mut self, indices: &[usize]) -> Option<&mut T>
pub fn get_mut(&mut self, indices: &[usize]) -> Option<&mut T>
Mutably borrow one host element by logical index.
§Examples
use tenferro_tensor::TypedTensorViewMut;
let mut data = [1_i32, 2];
let mut view = TypedTensorViewMut::from_slice(vec![2], vec![1], 0, &mut data)?;
*view.get_mut(&[1]).unwrap() = 20;
assert_eq!(view.get(&[1]), Some(&20));pub fn duplicate(&self) -> Result<TypedTensor<T, R>, Error>where
T: TensorScalar,
pub fn duplicate(&self) -> Result<TypedTensor<T, R>, Error>where
T: TensorScalar,
Borrow this mutable view as a read-only view.
§Examples
use tenferro_tensor::TypedTensorViewMut;
let mut data = [1_i32];
let view = TypedTensorViewMut::from_slice(vec![1], vec![1], 0, &mut data)?;
assert_eq!(view.as_read_only().get(&[0]), Some(&1));Explicitly duplicate the compact host data visible through this mutable view into a new owner.
§Errors
Returns [crate::Error::HostAccess] or
[ValidationError::NonContiguousViewAsSlice] when the view is backend
owned or not contiguous, and [ValidationError::InvalidArgument] when
the static-rank shape cannot be reconstructed.
§Examples
use tenferro_tensor::TypedTensorViewMut;
let mut data = [1_i32, 2];
let view = TypedTensorViewMut::from_slice(vec![2], vec![1], 0, &mut data)?;
let copy = view.duplicate()?;
assert_eq!(copy.as_slice()?, &[1, 2]);pub fn as_read_only(&self) -> TypedTensorView<'_, T, R>
pub fn into_read_only(self) -> TypedTensorView<'a, T, R>
pub fn into_read_only(self) -> TypedTensorView<'a, T, R>
Convert this mutable view into a read-only view.
§Examples
use tenferro_tensor::TypedTensorViewMut;
let mut data = [1_i32];
let view = TypedTensorViewMut::from_slice(vec![1], vec![1], 0, &mut data)?;
assert_eq!(view.into_read_only().get(&[0]), Some(&1));pub fn transpose_view(
self,
axes: impl AsRef<[usize]>,
) -> Result<TypedTensorViewMut<'a, T, R>, Error>
pub fn transpose_view( self, axes: impl AsRef<[usize]>, ) -> Result<TypedTensorViewMut<'a, T, R>, Error>
Consume this mutable view and return a metadata-only axis permutation.
§Examples
use tenferro_tensor::{Rank, TypedTensorViewMut};
let mut data = [1_i32, 2, 3, 4];
let view = TypedTensorViewMut::<_, Rank<2>>::from_slice_ranked([2, 2], [1, 2], 0, &mut data)?;
let transposed = view.transpose_view([1, 0])?;
assert_eq!(transposed.strides(), &[2, 1]);§Errors
Returns [crate::Error::Validation] with
[tenferro_tensor_core::ValidationError::InvalidPermutationLength],
[tenferro_tensor_core::ValidationError::AxisOutOfBounds], or
[tenferro_tensor_core::ValidationError::DuplicateAxis] when axes is
not a valid permutation, [tenferro_tensor_core::ValidationError::OverlappingMutableLayout]
when the permutation creates aliases, or
[tenferro_tensor_core::ValidationError::IntegerOverflow] for layout
arithmetic overflow.
pub fn try_slice(
&mut self,
slices: &[StridedSliceSpec],
) -> Result<TypedTensorViewMut<'_, T, R>, Error>
pub fn try_slice( &mut self, slices: &[StridedSliceSpec], ) -> Result<TypedTensorViewMut<'_, T, R>, Error>
Return a mutable metadata-only slice using one [StridedSliceSpec] per axis.
§Examples
use tenferro_tensor::{StridedSliceSpec, TypedTensorViewMut};
let mut data = [1_i32, 2, 3];
let mut view = TypedTensorViewMut::from_slice(vec![3], vec![1], 0, &mut data)?;
*view.try_slice(&[StridedSliceSpec::reverse()])?.get_mut(&[0]).unwrap() = 30;
assert_eq!(view.get(&[2]), Some(&30));§Errors
Returns [crate::Error::Validation] with
[tenferro_tensor_core::ValidationError::RankMismatch] when the slice
count differs from the view rank,
[tenferro_tensor_core::ValidationError::InvalidSliceStep] or
[tenferro_tensor_core::ValidationError::InvalidSliceBounds] for an
invalid slice, [tenferro_tensor_core::ValidationError::ViewOutOfBounds]
when the result exceeds the backing buffer,
[tenferro_tensor_core::ValidationError::OverlappingMutableLayout] when
logical elements alias, or
[tenferro_tensor_core::ValidationError::IntegerOverflow] for layout
arithmetic overflow.
pub fn try_slice_axis(
&mut self,
axis: usize,
slice: StridedSliceSpec,
) -> Result<TypedTensorViewMut<'_, T, R>, Error>
pub fn try_slice_axis( &mut self, axis: usize, slice: StridedSliceSpec, ) -> Result<TypedTensorViewMut<'_, T, R>, Error>
Return a mutable metadata-only slice along one axis.
§Examples
use tenferro_tensor::{StridedSliceSpec, TypedTensorViewMut};
let mut data = [1_i32, 2, 3, 4];
let mut view = TypedTensorViewMut::from_slice(vec![2, 2], vec![1, 2], 0, &mut data)?;
assert_eq!(view.try_slice_axis(1, StridedSliceSpec::reverse())?.get(&[0, 0]), Some(&3));§Errors
Returns [crate::Error::Validation] with
[tenferro_tensor_core::ValidationError::AxisOutOfBounds] when axis
is outside the view rank, [tenferro_tensor_core::ValidationError::InvalidSliceStep]
or [tenferro_tensor_core::ValidationError::InvalidSliceBounds] for an
invalid slice, [tenferro_tensor_core::ValidationError::ViewOutOfBounds]
when the result exceeds the backing buffer,
[tenferro_tensor_core::ValidationError::OverlappingMutableLayout] when
logical elements alias, or
[tenferro_tensor_core::ValidationError::IntegerOverflow] for layout
arithmetic overflow.
pub fn try_multi_slice_mut(
&mut self,
first: &[StridedSliceSpec],
second: &[StridedSliceSpec],
) -> Result<Option<(TypedTensorViewMut<'_, T, R>, TypedTensorViewMut<'_, T, R>)>, Error>
pub fn try_multi_slice_mut( &mut self, first: &[StridedSliceSpec], second: &[StridedSliceSpec], ) -> Result<Option<(TypedTensorViewMut<'_, T, R>, TypedTensorViewMut<'_, T, R>)>, Error>
Return two mutable metadata-only slices when their physical ranges are disjoint.
§Examples
use tenferro_tensor::{StridedSliceSpec, TypedTensorViewMut};
let mut data = [1_i32, 2, 3, 4];
let mut view = TypedTensorViewMut::from_slice(vec![4], vec![1], 0, &mut data)?;
let (left, right) = view
.try_multi_slice_mut(
&[StridedSliceSpec::new(0, Some(2), 1)],
&[StridedSliceSpec::new(2, Some(4), 1)],
)
?
.unwrap();
assert_eq!(left.shape(), &[2]);
assert_eq!(right.shape(), &[2]);§Errors
Returns [crate::Error::Validation] with
[tenferro_tensor_core::ValidationError::RankMismatch] for either
slice count, [tenferro_tensor_core::ValidationError::InvalidSliceStep]
or [tenferro_tensor_core::ValidationError::InvalidSliceBounds] for
invalid parameters, [tenferro_tensor_core::ValidationError::ViewOutOfBounds]
when a result exceeds the backing buffer,
[tenferro_tensor_core::ValidationError::OverlappingMutableLayout] when
a result aliases, [tenferro_tensor_core::ValidationError::InvalidArgument]
for a negative reachable offset, or
[tenferro_tensor_core::ValidationError::IntegerOverflow] for layout
arithmetic overflow. The method returns Ok(None) when the two ranges
overlap or the view uses backend storage.
pub fn try_reshape(
&mut self,
shape: &[usize],
) -> Result<TypedTensorViewMut<'_, T>, Error>
pub fn try_reshape( &mut self, shape: &[usize], ) -> Result<TypedTensorViewMut<'_, T>, Error>
Return a mutable metadata-only dynamic-rank reshape for contiguous views.
§Examples
use tenferro_tensor::TypedTensorViewMut;
let mut data = [1_i32, 2, 3, 4];
let mut view = TypedTensorViewMut::from_slice(vec![2, 2], vec![1, 2], 0, &mut data)?;
assert_eq!(view.try_reshape(&[4])?.shape(), &[4]);§Errors
Returns [crate::Error::Validation] with
[tenferro_tensor_core::ValidationError::NonContiguousViewAsSlice] when
the source is not compact column-major,
[tenferro_tensor_core::ValidationError::ShapeMismatch] (whose
[tenferro_tensor_core::ShapeMismatch::ReshapeElementCount] source
records the counts) when element counts differ,
[tenferro_tensor_core::ValidationError::OverlappingMutableLayout] when
the reshaped layout aliases, [tenferro_tensor_core::ValidationError::IntegerOverflow]
for shape or layout arithmetic overflow, or
[tenferro_tensor_core::ValidationError::ViewOutOfBounds] when the
reshaped view exceeds the backing buffer.
§impl<'a, R> TypedTensorViewMut<'a, Complex<f32>, R>where
R: TensorRank,
impl<'a, R> TypedTensorViewMut<'a, Complex<f32>, R>where
R: TensorRank,
pub fn as_real_view_mut(&mut self) -> Result<TypedTensorViewMut<'_, f32>, Error>
pub fn as_real_view_mut(&mut self) -> Result<TypedTensorViewMut<'_, f32>, Error>
Borrow this mutable complex view as an interleaved real view.
This changes only the typed descriptor and borrows the same host allocation. The result has dynamic rank because the component axis is prepended. Backend-native buffers are rejected until their provider phase supplies the corresponding mapping capability.
§Errors
Returns an error when the view layout is not injective, the sealed representation is invalid, or backend reinterpretation is unsupported.
§impl<'a, R> TypedTensorViewMut<'a, Complex<f64>, R>where
R: TensorRank,
impl<'a, R> TypedTensorViewMut<'a, Complex<f64>, R>where
R: TensorRank,
pub fn as_real_view_mut(&mut self) -> Result<TypedTensorViewMut<'_, f64>, Error>
pub fn as_real_view_mut(&mut self) -> Result<TypedTensorViewMut<'_, f64>, Error>
Borrow this mutable complex view as an interleaved real view.
This changes only the typed descriptor and borrows the same host allocation. The result has dynamic rank because the component axis is prepended. Backend-native buffers are rejected until their provider phase supplies the corresponding mapping capability.
§Errors
Returns an error when the view layout is not injective, the sealed representation is invalid, or backend reinterpretation is unsupported.
§impl<'a, R> TypedTensorViewMut<'a, f32, R>where
R: TensorRank,
impl<'a, R> TypedTensorViewMut<'a, f32, R>where
R: TensorRank,
pub fn as_complex_view_mut(
&mut self,
) -> Result<TypedTensorViewMut<'_, Complex<f32>>, Error>
pub fn as_complex_view_mut( &mut self, ) -> Result<TypedTensorViewMut<'_, Complex<f32>>, Error>
Borrow this mutable interleaved real view as a complex view.
The source must have a leading extent and stride of 2 and 1, and
all remaining strides plus the offset must be divisible by 2.
§Errors
Returns an error when the view layout is not injective, the sealed representation is invalid, or backend reinterpretation is unsupported.
§impl<'a, R> TypedTensorViewMut<'a, f64, R>where
R: TensorRank,
impl<'a, R> TypedTensorViewMut<'a, f64, R>where
R: TensorRank,
pub fn as_complex_view_mut(
&mut self,
) -> Result<TypedTensorViewMut<'_, Complex<f64>>, Error>
pub fn as_complex_view_mut( &mut self, ) -> Result<TypedTensorViewMut<'_, Complex<f64>>, Error>
Borrow this mutable interleaved real view as a complex view.
The source must have a leading extent and stride of 2 and 1, and
all remaining strides plus the offset must be divisible by 2.
§Errors
Returns an error when the view layout is not injective, the sealed representation is invalid, or backend reinterpretation is unsupported.
Trait Implementations§
Auto Trait Implementations§
impl<'a, T, R = DynRank> !RefUnwindSafe for TypedTensorViewMut<'a, T, R>
impl<'a, T, R = DynRank> !Sync for TypedTensorViewMut<'a, T, R>
impl<'a, T, R = DynRank> !UnwindSafe for TypedTensorViewMut<'a, T, R>
impl<'a, T, R> Freeze for TypedTensorViewMut<'a, T, R>
impl<'a, T, R> Send for TypedTensorViewMut<'a, T, R>
impl<'a, T, R> Unpin for TypedTensorViewMut<'a, T, R>
impl<'a, T, R> UnsafeUnpin for TypedTensorViewMut<'a, T, R>where
<R as TensorRank>::Shape: UnsafeUnpin,
<R as TensorRank>::Strides: UnsafeUnpin,
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
§impl<T> DistributionExt for Twhere
T: ?Sized,
impl<T> DistributionExt for Twhere
T: ?Sized,
fn rand<T>(&self, rng: &mut (impl Rng + ?Sized)) -> Twhere
Self: Distribution<T>,
impl<T, U> Imply<T> for U
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 moreimpl<T> MaybeSend for Twhere
T: Send,
§impl<T> Pointable for T
impl<T> Pointable for T
impl<T> Read<Exclusive, BecauseExclusive> for Twhere
T: ?Sized,
§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
self from the equivalent element of its
superset. Read more§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
self is actually part of its subset T (and can be converted to it).§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
self.to_subset but without any property checks. Always succeeds.§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
self to the equivalent element of its superset.