pub struct AST {
pub version: f32,
pub globals: RwLock<HashMap<String, String>>,
pub vars: RwLock<HashMap<String, String>>,
pub subs: HashMap<String, String>,
pub person: HashMap<String, String>,
pub arrays: HashMap<String, Vec<String>>,
pub topics: HashMap<String, Topic>,
pub objects: HashMap<String, Object>,
}Expand description
Root of the “abstract syntax tree” representing a RiveScript source document and its useful contents.
Fields§
§version: f32§globals: RwLock<HashMap<String, String>>§vars: RwLock<HashMap<String, String>>§subs: HashMap<String, String>§person: HashMap<String, String>§arrays: HashMap<String, Vec<String>>§topics: HashMap<String, Topic>§objects: HashMap<String, Object>Implementations§
Source§impl AST
impl AST
Sourcepub fn extend(&mut self, other: AST)
pub fn extend(&mut self, other: AST)
Merge the current AST with the contents of the other.
This is used during parsing when e.g. loading a whole directory of files. All parsed files add to the loaded AST for the root RiveScript instance.
Sourcepub fn init_topic(&mut self, name: &String)
pub fn init_topic(&mut self, name: &String)
Initialize the data structure for a new topic, if it wasn’t already there.
Sourcepub fn has_begin_block(&self) -> bool
pub fn has_begin_block(&self) -> bool
Returns true if a >begin section exists.
Sourcepub fn get_global(&self, name: &str) -> String
pub fn get_global(&self, name: &str) -> String
Get a global variable. Returns “undefined” if not set.
Sourcepub fn set_global(&self, name: &str, value: &str)
pub fn set_global(&self, name: &str, value: &str)
Set a global variable.
Sourcepub fn get_bot_var(&self, name: &str) -> String
pub fn get_bot_var(&self, name: &str) -> String
Get a bot variable. Returns “undefined” if not set.
Sourcepub fn set_bot_var(&self, name: &str, value: &str)
pub fn set_bot_var(&self, name: &str, value: &str)
Set a bot variable.
Trait Implementations§
Auto Trait Implementations§
impl !Freeze for AST
impl RefUnwindSafe for AST
impl Send for AST
impl Sync for AST
impl Unpin for AST
impl UnsafeUnpin for AST
impl UnwindSafe for AST
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