pub trait HasStructure {
type Store<S>: HasStructure<Structure = S>
where S: TensorStructure;
type Structure: TensorStructure;
type Scalar;
type ScalarRef<'a>
where Self: 'a;
// Required methods
fn map_structure<O: TensorStructure>(
self,
f: impl Fn(Self::Structure) -> O,
) -> Self::Store<O>;
fn map_structure_result<O: TensorStructure, Er>(
self,
f: impl Fn(Self::Structure) -> Result<O, Er>,
) -> Result<Self::Store<O>, Er>;
fn structure(&self) -> &Self::Structure;
fn mut_structure(&mut self) -> &mut Self::Structure;
fn scalar(self) -> Option<Self::Scalar>;
fn scalar_ref(&self) -> Option<Self::ScalarRef<'_>>;
fn map_same_structure(
self,
f: impl FnOnce(Self::Structure) -> Self::Structure,
) -> Self;
// Provided methods
fn set_structure_name<N>(&mut self, name: N)
where Self::Structure: HasName<Name = N> { ... }
fn structure_name(&self) -> Option<<Self::Structure as HasName>::Name>
where Self::Structure: HasName { ... }
fn structure_id(&self) -> Option<<Self::Structure as HasName>::Args>
where Self::Structure: HasName { ... }
}Required Associated Types§
type Store<S>: HasStructure<Structure = S> where S: TensorStructure
type Structure: TensorStructure
type Scalar
type ScalarRef<'a> where Self: 'a
Required Methods§
fn map_structure<O: TensorStructure>( self, f: impl Fn(Self::Structure) -> O, ) -> Self::Store<O>
fn map_structure_result<O: TensorStructure, Er>( self, f: impl Fn(Self::Structure) -> Result<O, Er>, ) -> Result<Self::Store<O>, Er>
fn structure(&self) -> &Self::Structure
fn mut_structure(&mut self) -> &mut Self::Structure
fn scalar(self) -> Option<Self::Scalar>
fn scalar_ref(&self) -> Option<Self::ScalarRef<'_>>
fn map_same_structure( self, f: impl FnOnce(Self::Structure) -> Self::Structure, ) -> Self
Provided Methods§
fn set_structure_name<N>(&mut self, name: N)
fn structure_name(&self) -> Option<<Self::Structure as HasName>::Name>
fn structure_id(&self) -> Option<<Self::Structure as HasName>::Args>
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.