Struct Globals

Source
pub struct Globals { /* private fields */ }
Expand description

The global state for mtots

Implementations§

Source§

impl Globals

Source

pub fn add<E: Into<GlobalElement>>(&mut self, e: E) -> Result<()>

Source§

impl Globals

Functions for readline-style editing and history These functions only work if the “line” feature of this crate is enabled. Otherwise these will be nops (for history related) and a much more primitive implementation (for the readline method).

Source

pub fn readline(&mut self, prompt: &str) -> Result<Option<String>>

Read a line of input Analogous to Python’s ‘input’ function Uses rustyline if the line feature is enabled

Source

pub fn save_line_history(&mut self) -> Result<()>

Source§

impl Globals

Source

pub fn new_handle<T: Any>(&mut self, t: T) -> Result<Handle<T>>

Source

pub fn set_handle_class<T: Any>(&mut self, cls: Rc<Class>) -> Result<()>

Source§

impl Globals

Source

pub fn load(&mut self, name: &RcStr) -> Result<&Rc<Module>>

Source§

impl Globals

Source

pub fn parse(&self, source: Rc<Source>) -> Result<ModuleDisplay>

Source

pub fn repl_ready(&self, line: &str) -> bool

Source§

impl Globals

Source

pub fn stash(&self) -> &Stash

Source

pub fn stash_mut(&mut self) -> &mut Stash

Source§

impl Globals

Source

pub fn handle_trampoline(self)

If there is any pending trampoline request, handle it.

Source

pub fn handle_trampoline_and_last_result<T>(self, r: Result<T>)

Source

pub fn request_trampoline<R, F>(&mut self, trampoline: F) -> Result<R>
where F: FnOnce(Globals) + 'static,

Source§

impl Globals

Source

pub fn new() -> Self

Source

pub fn trace(&self) -> &Vec<Mark>

Source

pub fn trace_unwind(&mut self, len: usize)

Source

pub fn register_module(&mut self, module: Rc<Module>) -> Result<()>

Source

pub fn class_manager(&self) -> &ClassManager

Source

pub fn get_main(&self) -> &Option<RcStr>

Source

pub fn set_main(&mut self, main_module_name: RcStr)

Source

pub fn exec(&mut self, source: Rc<Source>) -> Result<Rc<Module>>

Source

pub fn exec_str( &mut self, name: &str, path: Option<&str>, data: &str, ) -> Result<Rc<Module>>

Source

pub fn exec_repl(&mut self, data: &str) -> Result<Value>

Source

pub fn argv(&self) -> &Option<Vec<RcStr>>

Source

pub fn set_argv(&mut self, argv: Vec<RcStr>)

Source§

impl Globals

Auto Trait Implementations§

§

impl Freeze for Globals

§

impl !RefUnwindSafe for Globals

§

impl !Send for Globals

§

impl !Sync for Globals

§

impl Unpin for Globals

§

impl !UnwindSafe for Globals

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

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

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.