[−][src]Struct weld::WeldContext
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 Clone for WeldContext
[src]
fn clone(&self) -> WeldContext
[src]
fn clone_from(&mut self, source: &Self)
1.0.0[src]
impl Debug for WeldContext
[src]
impl PartialEq<WeldContext> for WeldContext
[src]
fn eq(&self, other: &WeldContext) -> bool
[src]
fn ne(&self, other: &WeldContext) -> bool
[src]
impl StructuralPartialEq for WeldContext
[src]
Auto Trait Implementations
impl !RefUnwindSafe for WeldContext
impl !Send for WeldContext
impl !Sync for WeldContext
impl Unpin for WeldContext
impl !UnwindSafe for WeldContext
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,