FieldTrait

Trait FieldTrait 

Source
pub trait FieldTrait<'a>: Sized + Debug {
Show 13 methods // Required methods fn gulp(&'a self, expr: Expr<'a, Self>) -> Expr<'a, Self>; fn get_val(r: FieldRef<'a, Self>) -> F; fn get_const(r: FieldRef<'a, Self>) -> Const; fn get_fn(r: FieldRef<'a, Self>) -> ExprFn<'a, Self>; fn get_sum(r: FieldRef<'a, Self>) -> Ref<'_, Sum<'a, Self>>; fn get_prod(r: FieldRef<'a, Self>) -> Ref<'_, Prod<'a, Self>>; fn add_svec(&'a self, s: SVec<'a, Self>) -> Expr<'a, Self>; fn add_pvec(&'a self, p: PVec<'a, Self>) -> Expr<'a, Self>; fn add_val(&'a self, v: F) -> Expr<'a, Self>; fn add_const(&'a self, c: Const) -> Expr<'a, Self>; fn add_fn(&'a self, f: ExprFn<'a, Self>) -> Expr<'a, Self>; fn try_distribute_prod(p: FieldRef<'a, Self>) -> Option<Expr<'a, Self>>; fn parse(&'a self, input: &str) -> Expr<'a, Self>;
}

Required Methods§

Source

fn gulp(&'a self, expr: Expr<'a, Self>) -> Expr<'a, Self>

Create a new Field Add all elements of the expr to field

Source

fn get_val(r: FieldRef<'a, Self>) -> F

Source

fn get_const(r: FieldRef<'a, Self>) -> Const

Source

fn get_fn(r: FieldRef<'a, Self>) -> ExprFn<'a, Self>

Source

fn get_sum(r: FieldRef<'a, Self>) -> Ref<'_, Sum<'a, Self>>

Source

fn get_prod(r: FieldRef<'a, Self>) -> Ref<'_, Prod<'a, Self>>

Source

fn add_svec(&'a self, s: SVec<'a, Self>) -> Expr<'a, Self>

Add a raw sum vector to the field. Should implement the following simplifications:

Σ() -> O
Σ(1,I) -> I
Σ(v,I) -> ξv
Σ[(1,π),(1,I)] -> Σ[(1,I),(1,π)]
Source

fn add_pvec(&'a self, p: PVec<'a, Self>) -> Expr<'a, Self>

Add a raw product vector to the field. Should implement the following:

Π() -> I
Π(ξv,1) -> ξv
Π[(ξv,1),...] -> Σ(v,Π[...]) <- this is ugly and adds unnecessary ξv to the field
Source

fn add_val(&'a self, v: F) -> Expr<'a, Self>

Source

fn add_const(&'a self, c: Const) -> Expr<'a, Self>

Source

fn add_fn(&'a self, f: ExprFn<'a, Self>) -> Expr<'a, Self>

Source

fn try_distribute_prod(p: FieldRef<'a, Self>) -> Option<Expr<'a, Self>>

Try to distribute a product to a sum. Not sure if recursively

Π[(π,2),(Σ(2,π),1)] -> Σ(2,Π(π,3))
Π(Σ[1,√5],2) -> Π[Σ[1,√5],Σ[1,√5]] -> Σ[1,2√5,5] -> Σ[6,2√5] -/-> Σ(2,Σ[3,√5])
Source

fn parse(&'a self, input: &str) -> Expr<'a, Self>

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<'a> FieldTrait<'a> for TypeField<'a>