pub struct Context { /* private fields */ }Expand description
A Context object we will be handing to evaluators so they are aware of external registered Functions.
Implementations§
Source§impl Context
impl Context
Sourcepub fn new() -> Self
pub fn new() -> Self
Create a new instance w/ no registered functions and the globally configured implicit CRS.
Sourcepub fn try_with_crs(crs_code: &str) -> Result<Self, MyError>
pub fn try_with_crs(crs_code: &str) -> Result<Self, MyError>
Create a new instance w/ an implicit CRS specified by a given code.
Use this method to override the global default CRS code configured by
setting the environment variable DEFAULT_CRS.
Sourcepub fn register<F>(
&mut self,
name: &str,
arg_types: Vec<ExtDataType>,
result_type: ExtDataType,
closure: F,
)
pub fn register<F>( &mut self, name: &str, arg_types: Vec<ExtDataType>, result_type: ExtDataType, closure: F, )
Register a Function (Rust Closure) by name with expected argument(s) and result types.
Sourcepub fn freeze(self) -> SharedContext
pub fn freeze(self) -> SharedContext
Return a safe share-able read-only version of this frozen at the time of the call.
Sourcepub fn fn_info(&self, name: &str) -> Option<&FnInfo>
pub fn fn_info(&self, name: &str) -> Option<&FnInfo>
Return meta-information about a Function already registered in this.
Sourcepub fn register_builtins(&mut self)
pub fn register_builtins(&mut self)
Register all builtin functions we support.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Context
impl !RefUnwindSafe for Context
impl !Send for Context
impl !Sync for Context
impl Unpin for Context
impl !UnwindSafe for Context
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more