pub struct Script { /* private fields */ }Expand description
Represents a parsed OpenScript program
Implementations§
Source§impl Script
impl Script
Sourcepub fn parse(source: &str) -> Result<Self>
pub fn parse(source: &str) -> Result<Self>
Parse OpenScript source code into an executable script
§Arguments
source- The OpenScript source code to parse
§Returns
A Result containing the parsed Script or a parse error
§Examples
use openscript::Script;
let script = Script::parse(r#“ name = “OpenScript” echo “Hello from ${name}!” “#)?;
§Ok::<(), openscript::Error>(())
Sourcepub fn statements(&self) -> &[Statement]
pub fn statements(&self) -> &[Statement]
Get the parsed statements
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Script
impl RefUnwindSafe for Script
impl Send for Script
impl Sync for Script
impl Unpin for Script
impl UnwindSafe for Script
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