Struct FunctionF32

Source
pub struct FunctionF32 {
    pub name: String,
    /* private fields */
}
Expand description

Description of a function accessible to the compiled program

Currently only functions of the form fn(f32, [f32, ..]) -> f32 are supported.

Fields§

§name: String

Name of the function exposed to the program

Implementations§

Source§

impl FunctionF32

Source

pub fn new_1(name: String, ptr: extern "C" fn(f32) -> f32) -> Self

Constructs a new instance of 1-argument FunctionF32

Source

pub fn new_2(name: String, ptr: extern "C" fn(f32, f32) -> f32) -> Self

Constructs a new instance of 2-argument FunctionF32

Source

pub fn call_1(&self, x: f32) -> Option<f32>

Call this function with 1 argument

Returns None if parameter count is incorrect.

Source

pub fn call_2(&self, x: f32, y: f32) -> Option<f32>

Call this function with 2 arguments

Returns None if parameter count is incorrect.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.