pub struct Program {
pub context: Context,
}Expand description
is a part of the program, contains the context, i is capable of executing Use example:
use procc_ll::Program;
let mut main = Program::new();
// now use the main ProgramBlockFields§
§context: ContextImplementations§
Source§impl Program
impl Program
pub fn new() -> Rc<RefCell<Self>>
pub fn new_from_context(context: Context) -> Self
Sourcepub fn exec(&mut self, token: &str) -> Result<Values, Errors>
pub fn exec(&mut self, token: &str) -> Result<Values, Errors>
Executes a new token Use example:
use procc_ll::Program;
let mut main = Program::new();
main.borrow_mut().push_internal_key("echo", |tok, prog| {
print!("{}" ,tok);
procc_ll::Values::Null
});
main.borrow_mut().exec("echo hello world!!");Sourcepub fn push_internal_token(&mut self, token: Box<dyn Token>)
pub fn push_internal_token(&mut self, token: Box<dyn Token>)
Push a new token in the context
Sourcepub fn push_internal_key(
&mut self,
key: &str,
func: impl Fn(String, &mut Program) -> Values + 'static,
)
pub fn push_internal_key( &mut self, key: &str, func: impl Fn(String, &mut Program) -> Values + 'static, )
push a new key on the context
Sourcepub fn push_internal_memory(&mut self, key: &str, val: Values)
pub fn push_internal_memory(&mut self, key: &str, val: Values)
push a new value on the context
Sourcepub fn push_internal_function(
&mut self,
name: &str,
func: impl Fn(Vec<Values>, &mut Program) -> Values + 'static,
)
pub fn push_internal_function( &mut self, name: &str, func: impl Fn(Vec<Values>, &mut Program) -> Values + 'static, )
push a new function on the context
pub fn new_depth_context(&mut self) -> Rc<RefCell<Program>>
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Program
impl !RefUnwindSafe for Program
impl !Send for Program
impl !Sync for Program
impl Unpin for Program
impl !UnwindSafe for Program
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit)