IntoNode

Trait IntoNode 

Source
pub trait IntoNode {
    // Required method
    fn into_node(self, ctx: &mut Context) -> Result<Node, Error>;
}
Expand description

Helper trait for things that can be converted into a Node given a Context.

This trait allows you to write

let x = ctx.x();
let sum = ctx.add(x, 1.0).unwrap();

instead of the more verbose

let x = ctx.x();
let num = ctx.constant(1.0);
let sum = ctx.add(x, num).unwrap();

Required Methods§

Source

fn into_node(self, ctx: &mut Context) -> Result<Node, Error>

Converts the given values into a node

Implementations on Foreign Types§

Source§

impl IntoNode for f32

Source§

fn into_node(self, ctx: &mut Context) -> Result<Node, Error>

Source§

impl IntoNode for f64

Source§

fn into_node(self, ctx: &mut Context) -> Result<Node, Error>

Implementors§