Struct snek::Symbol [] [src]

pub struct Symbol<'a> {
    // some fields omitted
}

This provides an interface around a symbol loaded from a dynamic library. This should not be constructed manually, but returned from Snek::symbol or used internally via the snek! macro.

Methods

impl<'a> Symbol<'a>
[src]

fn new(symbol: *mut c_void) -> Symbol<'a>

Construct a new Symbol wrapping a symbol. This should not be used manually, however is public to allow access from the snek! macro.

fn with<F, T, U>(&self, f: F) -> U where F: Fn(T) -> U

Use the symbol as if it was a certain type. There is no way of checking that the symbol is of the specified type, so this function should be used with care.

Example

let result: c_int =  symbol.with(|add: extern fn(c_int, c_int) -> c_int| add(3, 7));

Trait Implementations

impl<'a> Debug for Symbol<'a>
[src]

fn fmt(&self, __arg_0: &mut Formatter) -> Result

Formats the value using the given formatter.