[][src]Struct weld::WeldContext

pub struct WeldContext { /* fields omitted */ }

A context for a Weld program.

Contexts are internally reference counted, so cloning a context will produce a reference to the same internal object. The reference-counted internal object is protected via a RefCell to prevent double-mutable-borrows: this is necessary because contexts may not be passed into multiple WeldModule::run calls in parallel, even if they are cloned (since cloned contexts point to the same underlying object).

Contexts are not thread-safe, and thus do not implement Send+Sync.

Methods

impl WeldContext[src]

pub fn new(conf: &WeldConf) -> WeldResult<WeldContext>[src]

Returns a new WeldContext with the given configuration.

Errors

Returns an error if the configuration is malformed.

Examples

use weld::{WeldConf, WeldContext};

// Create a new default configuration.
let conf = &mut WeldConf::new();

// Set 1KB memory limit, 2 worker threads.
conf.set("weld.memory.limit", "1024");
conf.set("weld.threads", "2");

// Create a context.
let context = WeldContext::new(conf).unwrap();

pub fn memory_usage(&self) -> i64[src]

Returns the memory used by this context.

Examples

use weld::{WeldConf, WeldContext};

let context = WeldContext::new(&WeldConf::new()).unwrap();
assert_eq!(context.memory_usage(), 0);

pub fn memory_limit(&self) -> i64[src]

Returns the memory limit of this context.

Examples

use weld::{WeldConf, WeldContext};

let conf = &mut WeldConf::new();

// Set 1KB memory limit, 2 worker threads.
conf.set("weld.memory.limit", "1024");

let context = WeldContext::new(conf).unwrap();
assert_eq!(context.memory_limit(), 1024);

Trait Implementations

impl PartialEq<WeldContext> for WeldContext[src]

impl Clone for WeldContext[src]

fn clone_from(&mut self, source: &Self)
1.0.0
[src]

Performs copy-assignment from source. Read more

impl Debug for WeldContext[src]

Auto Trait Implementations

impl !Send for WeldContext

impl !Sync for WeldContext

Blanket Implementations

impl<T, U> Into for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

impl<T> From for T[src]

impl<T, U> TryFrom for T where
    T: From<U>, 
[src]

type Error = !

🔬 This is a nightly-only experimental API. (try_from)

The type returned in the event of a conversion error.

impl<T> Borrow for T where
    T: ?Sized
[src]

impl<T> BorrowMut for T where
    T: ?Sized
[src]

impl<T, U> TryInto for T where
    U: TryFrom<T>, 
[src]

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

🔬 This is a nightly-only experimental API. (try_from)

The type returned in the event of a conversion error.

impl<T> Any for T where
    T: 'static + ?Sized
[src]