Struct FileBuilder

Source
pub struct FileBuilder<'a, Stdout, Stderr>
where Stdout: Write + Clone, Stderr: Write + Clone,
{ pub environment: &'a RefCell<Environment<Stdout, Stderr>>, pub last: Option<Rc<Val>>, pub out: Option<Rc<Val>>, /* private fields */ }
Expand description

Builder handles building ucg code for a single file.

Fields§

§environment: &'a RefCell<Environment<Stdout, Stderr>>§last: Option<Rc<Val>>§out: Option<Rc<Val>>

Implementations§

Source§

impl<'a, Stdout, Stderr> FileBuilder<'a, Stdout, Stderr>
where Stdout: Write + Clone, Stderr: Write + Clone,

Source

pub fn new<P: Into<PathBuf>>( working_dir: P, import_paths: &'a Vec<PathBuf>, environment: &'a RefCell<Environment<Stdout, Stderr>>, ) -> Self

Constructs a new Builder.

Source

pub fn clone_builder(&self) -> Self

Source

pub fn set_strict(&mut self, strict: bool)

Source

pub fn build<P: Into<PathBuf>>(&mut self, file: P) -> Result<(), Box<dyn Error>>

Builds a ucg file at the named path.

Source

pub fn enable_validate_mode(&mut self)

Puts the builder in validation mode.

Among other things this means that assertions will be evaluated and their results will be saved in a report for later output.

Source

pub fn eval_stmts( &mut self, ast: Vec<Statement>, path: Option<PathBuf>, ) -> Result<(), Box<dyn Error>>

Builds a list of parsed UCG Statements.

Source

pub fn repl( &mut self, editor: Editor<()>, config_home: PathBuf, ) -> Result<(), Box<dyn Error>>

Source

pub fn eval_input( &mut self, input: OffsetStrIter<'_>, path: Option<PathBuf>, ) -> Result<Rc<Val>, Box<dyn Error>>

Source

pub fn eval_string(&mut self, input: &str) -> Result<Rc<Val>, Box<dyn Error>>

Evaluate an input string as UCG.

Source

pub fn eval_expr(&mut self, expr: Expression) -> Result<Rc<Val>, Box<dyn Error>>

Source

pub fn get_out_by_name(&self, name: &str) -> Option<Rc<Val>>

Source

pub fn assert_results(&self) -> bool

Source

pub fn assert_summary(&self) -> String

Auto Trait Implementations§

§

impl<'a, Stdout, Stderr> Freeze for FileBuilder<'a, Stdout, Stderr>

§

impl<'a, Stdout, Stderr> !RefUnwindSafe for FileBuilder<'a, Stdout, Stderr>

§

impl<'a, Stdout, Stderr> !Send for FileBuilder<'a, Stdout, Stderr>

§

impl<'a, Stdout, Stderr> !Sync for FileBuilder<'a, Stdout, Stderr>

§

impl<'a, Stdout, Stderr> Unpin for FileBuilder<'a, Stdout, Stderr>

§

impl<'a, Stdout, Stderr> !UnwindSafe for FileBuilder<'a, Stdout, Stderr>

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.