pub struct CommonCore { /* private fields */ }Implementations§
Source§impl CommonCore
impl CommonCore
pub fn new(core: Weak<dyn Core>) -> Rc<Self>
Sourcepub fn read(&self, riddle: &str) -> Result<(), RiddleError>
pub fn read(&self, riddle: &str) -> Result<(), RiddleError>
Parses and executes a RiDDLe problem in this core context.
The parsed problem metadata is registered in the current scope, then each statement is executed in order using this core scope and environment.
Returns an error if parsing or execution fails.
Sourcepub fn add_type(&self, tp: Rc<dyn Type>)
pub fn add_type(&self, tp: Rc<dyn Type>)
Registers a type in the core type table under its declared name.
pub fn get_objects(&self) -> Vec<Rc<Object>>
pub fn get_object(&self, id: ObjectId) -> Option<Rc<Object>>
pub fn new_object(&self, class: Rc<dyn Class>) -> ObjectId
pub fn get_atoms(&self) -> Vec<Rc<Atom>>
pub fn get_atom(&self, id: AtomId) -> Option<Rc<Atom>>
pub fn new_atom( &self, predicate: Rc<Predicate>, fact: bool, args: HashMap<String, Slot>, ) -> AtomId
Trait Implementations§
Source§impl Env for CommonCore
impl Env for CommonCore
Source§impl Scope for CommonCore
impl Scope for CommonCore
fn core(&self) -> Rc<dyn Core>
fn scope(&self) -> Option<Rc<dyn Scope>>
fn get_fields(&self) -> Vec<Rc<Field>>
fn get_field(&self, name: &str) -> Option<Rc<Field>>
fn get_function( &self, name: &str, types: &[Rc<dyn Type>], ) -> Option<Rc<Function>>
fn get_type(&self, name: &str) -> Option<Rc<dyn Type>>
fn get_predicate(&self, name: &str) -> Option<Rc<Predicate>>
fn as_class(self: Rc<Self>) -> Option<Rc<dyn Class>>
Auto Trait Implementations§
impl !Freeze for CommonCore
impl !RefUnwindSafe for CommonCore
impl !Send for CommonCore
impl !Sync for CommonCore
impl Unpin for CommonCore
impl UnsafeUnpin for CommonCore
impl !UnwindSafe for CommonCore
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