Struct jit::Context [] [src]

pub struct Context<T = ()> {
    // some fields omitted

Holds all of the functions you have built and compiled. There can be multiple, but normally there is only one.

The type parameter T represents the type of the tagged data on the context, which can be indexed to get this data. If you do not want to tag the context with data, make sure to instantiate it with a unit (()) for T, like so:

use jit::Context;
let ctx = Context::<()>::new();

However, if you do want to set tagged data on it, simply put the type of the data as the T parameter when you instantiate it, like so:

use jit::Context;
let mut ctx = Context::<usize>::new();
ctx[0] = 42;
ctx[1] = 21;
assert_eq!(ctx[0], 42);
assert_eq!(ctx[1], 21);


impl<T = ()> Context<T>

fn new() -> Context<T>

Create a new JIT Context

fn functions(&self) -> Functions

Iterate through the functions contained inside this context

Trait Implementations

impl<T> From<jit_context_t> for Context<T>

fn from(ptr: jit_context_t) -> Context<T>

impl<T = ()> Index<i32> for Context<T>

type Output = T

fn index(&self, index: i32) -> &T

impl<T = ()> IndexMut<i32> for Context<T>

fn index_mut(&mut self, index: i32) -> &mut T

impl !Send for Context

impl<'a, T> IntoIterator for &'a Context<T>

type IntoIter = Functions<'a>

type Item = &'a Func

fn into_iter(self) -> Functions<'a>

impl<T> Drop for Context<T>

fn drop(&mut self)