Skip to main content

EinsumSpec

Trait EinsumSpec 

Source
pub trait EinsumSpec {
    // Required method
    fn spec(&self) -> Spec<'_>;
}
Expand description

Anything an einsum accepts as its spec argument: str, String, EinsumNotation, EinsumSubscripts or a Spec. Operations take it by reference, so "ij,jk->ik", &notation and &subscripts all work.

§Examples

use tenferro_einsum::{EinsumNotation, EinsumSpec, Spec};

assert!(matches!("ij->j".spec(), Spec::Text("ij->j")));
let notation = EinsumNotation::parse("ij->j")?;
assert!(matches!(notation.spec(), Spec::Notation(_)));

Required Methods§

Source

fn spec(&self) -> Spec<'_>

The spec this value denotes; never fails and never parses.

§Examples
use tenferro_einsum::{EinsumSpec, Spec};

let owned = String::from("ij,jk->ik");
assert!(matches!(owned.spec(), Spec::Text("ij,jk->ik")));

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementations on Foreign Types§

Source§

impl EinsumSpec for String

Source§

fn spec(&self) -> Spec<'_>

Source§

impl EinsumSpec for str

Source§

fn spec(&self) -> Spec<'_>

Implementors§