pub struct Context(/* private fields */);Expand description
A structure that holds several CompiledProgramAnalysers which are used to analyse one or more compiled Yarn programs with Dialogue::analyse.
To get the analysis results, call Context::finish_analysis afterwards.
Implementations§
Source§impl Context
impl Context
Sourcepub fn default_analysers() -> Context
pub fn default_analysers() -> Context
Sets up a Context with the default analysers. These are:
- Variable Lister: Adds a
DiagnosisSeverity::Notediagnosis for each variable in the program. - Unused Variable Checker: Adds a
DiagnosisSeverity::Warningdiagnosis for each unused variable in the program.
Sourcepub fn add_analyser(self, analyser: Box<dyn CompiledProgramAnalyser>) -> Context
pub fn add_analyser(self, analyser: Box<dyn CompiledProgramAnalyser>) -> Context
Adds an analyser to the Context.
Sourcepub fn finish_analysis(&self) -> Vec<Diagnosis>
pub fn finish_analysis(&self) -> Vec<Diagnosis>
Collects the diagnoses from all analysers in the Context that were previously used with Dialogue::analyse.
Trait Implementations§
Source§impl Extend<Box<dyn CompiledProgramAnalyser>> for Context
impl Extend<Box<dyn CompiledProgramAnalyser>> for Context
Source§fn extend<T>(&mut self, iter: T)
fn extend<T>(&mut self, iter: T)
Extends a collection with the contents of an iterator. Read more
Source§fn extend_one(&mut self, item: A)
fn extend_one(&mut self, item: A)
🔬This is a nightly-only experimental API. (
extend_one)Extends a collection with exactly one element.
Source§fn extend_reserve(&mut self, additional: usize)
fn extend_reserve(&mut self, additional: usize)
🔬This is a nightly-only experimental API. (
extend_one)Reserves capacity in a collection for the given number of additional elements. Read more
Auto Trait Implementations§
impl Freeze for Context
impl !RefUnwindSafe for Context
impl !Send for Context
impl !Sync for Context
impl Unpin for Context
impl UnsafeUnpin for Context
impl !UnwindSafe for Context
Blanket Implementations§
Source§impl<T> AnyExt for T
impl<T> AnyExt for T
Source§fn downcast_ref<T>(this: &Self) -> Option<&T>where
T: Any,
fn downcast_ref<T>(this: &Self) -> Option<&T>where
T: Any,
Attempts to downcast this to
T behind referenceSource§fn downcast_mut<T>(this: &mut Self) -> Option<&mut T>where
T: Any,
fn downcast_mut<T>(this: &mut Self) -> Option<&mut T>where
T: Any,
Attempts to downcast this to
T behind mutable referenceSource§fn downcast_rc<T>(this: Rc<Self>) -> Result<Rc<T>, Rc<Self>>where
T: Any,
fn downcast_rc<T>(this: Rc<Self>) -> Result<Rc<T>, Rc<Self>>where
T: Any,
Attempts to downcast this to
T behind Rc pointerSource§fn downcast_arc<T>(this: Arc<Self>) -> Result<Arc<T>, Arc<Self>>where
T: Any,
fn downcast_arc<T>(this: Arc<Self>) -> Result<Arc<T>, Arc<Self>>where
T: Any,
Attempts to downcast this to
T behind Arc pointerSource§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