pub struct Builder { /* private fields */ }
Expand description
A builder for Runtime
.
Implementations§
Source§impl Builder
impl Builder
Sourcepub fn sandboxed(self, sandboxed: bool) -> Self
pub fn sandboxed(self, sandboxed: bool) -> Self
Set whether the runtime is sandboxed.
When sandboxed, only a limited set of modules can be imported, and some built-in functions are disabled. This is useful for running untrusted code.
Allowed modules: json
, decimal
, re
, math
, datetime
, time
.
Disallowed builtins: breakpoint
, exit
, eval
, help
, input
, open
, print
.
The default is false
.
Sourcepub fn remove_symbol(self, symbol: &str) -> Self
pub fn remove_symbol(self, symbol: &str) -> Self
Remove a symbol from builtins.
§Examples
let builder = Runtime::builder().remove_symbol("__builtins__.eval");
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Builder
impl RefUnwindSafe for Builder
impl Send for Builder
impl Sync for Builder
impl Unpin for Builder
impl UnwindSafe for Builder
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