HasStructure

Trait HasStructure 

Source
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§

Source

type Store<S>: HasStructure<Structure = S> where S: TensorStructure

Source

type Structure: TensorStructure

Source

type Scalar

Source

type ScalarRef<'a> where Self: 'a

Required Methods§

Source

fn map_structure<O: TensorStructure>( self, f: impl Fn(Self::Structure) -> O, ) -> Self::Store<O>

Source

fn map_structure_result<O: TensorStructure, Er>( self, f: impl Fn(Self::Structure) -> Result<O, Er>, ) -> Result<Self::Store<O>, Er>

Source

fn structure(&self) -> &Self::Structure

Source

fn mut_structure(&mut self) -> &mut Self::Structure

Source

fn scalar(self) -> Option<Self::Scalar>

Source

fn scalar_ref(&self) -> Option<Self::ScalarRef<'_>>

Source

fn map_same_structure( self, f: impl FnOnce(Self::Structure) -> Self::Structure, ) -> Self

Provided Methods§

Source

fn set_structure_name<N>(&mut self, name: N)
where Self::Structure: HasName<Name = N>,

Source

fn structure_name(&self) -> Option<<Self::Structure as HasName>::Name>
where Self::Structure: HasName,

Source

fn structure_id(&self) -> Option<<Self::Structure as HasName>::Args>
where Self::Structure: HasName,

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.

Implementors§

Source§

impl<Aind: AbsInd> HasStructure for SymbolicTensor<Aind>

Source§

impl<C, S> HasStructure for ParamOrConcrete<C, S>
where C: HasStructure<Structure = S>, S: TensorStructure,

Source§

impl<S> HasStructure for ParamTensor<S>
where S: TensorStructure,

Source§

type Structure = S

Source§

type Scalar = Atom

Source§

type ScalarRef<'a> = AtomView<'a> where Self: 'a

Source§

type Store<U> = ParamTensor<U> where U: TensorStructure

Source§

impl<S: TensorStructure> HasStructure for TensorShell<S>

Source§

type Structure = S

Source§

type Scalar = ()

Source§

type ScalarRef<'a> = &'a () where Self: 'a

Source§

type Store<U> = TensorShell<U> where U: TensorStructure

Source§

impl<T, I> HasStructure for DataTensor<T, I>
where I: TensorStructure,

Source§

type Scalar = T

Source§

type ScalarRef<'a> = &'a T where Self: 'a

Source§

type Structure = I

Source§

type Store<S> = DataTensor<T, S> where S: TensorStructure

Source§

impl<T, I> HasStructure for DenseTensor<T, I>
where I: TensorStructure,

Source§

type Scalar = T

Source§

type ScalarRef<'a> = &'a T where Self: 'a

Source§

type Structure = I

Source§

type Store<S> = DenseTensor<T, S> where S: TensorStructure

Source§

impl<T, I> HasStructure for SparseTensor<T, I>
where I: TensorStructure,

Source§

type Scalar = T

Source§

type ScalarRef<'a> = &'a T where Self: 'a

Source§

type Structure = I

Source§

type Store<S> = SparseTensor<T, S> where S: TensorStructure

Source§

impl<T, S: TensorStructure> HasStructure for EvalTensor<T, S>

Source§

type Scalar = T

Source§

type ScalarRef<'a> = &'a T where Self: 'a

Source§

type Structure = S

Source§

type Store<U> = EvalTensor<T, U> where U: TensorStructure

Source§

impl<T: Clone, S: TensorStructure> HasStructure for RealOrComplexTensor<T, S>

Source§

impl<T: HasStructure + TensorStructure> HasStructure for DummyLibraryTensor<T>

Source§

type Store<S> = <T as HasStructure>::Store<S> where S: TensorStructure

Source§

type Scalar = <T as HasStructure>::Scalar

Source§

type ScalarRef<'a> = <T as HasStructure>::ScalarRef<'a> where Self: 'a

Source§

type Structure = <T as HasStructure>::Structure