Skip to main content

CommonCore

Struct CommonCore 

Source
pub struct CommonCore { /* private fields */ }

Implementations§

Source§

impl CommonCore

Source

pub fn new(core: Weak<dyn Core>) -> Rc<Self>

Source

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.

Source

pub fn add_type(&self, tp: Rc<dyn Type>)

Registers a type in the core type table under its declared name.

Source

pub fn get_objects(&self) -> Vec<Rc<Object>>

Source

pub fn get_object(&self, id: ObjectId) -> Option<Rc<Object>>

Source

pub fn new_object(&self, class: Rc<dyn Class>) -> ObjectId

Source

pub fn get_atoms(&self) -> Vec<Rc<Atom>>

Source

pub fn get_atom(&self, id: AtomId) -> Option<Rc<Atom>>

Source

pub fn new_atom( &self, predicate: Rc<Predicate>, fact: bool, args: HashMap<String, Slot>, ) -> AtomId

Trait Implementations§

Source§

impl Env for CommonCore

Source§

fn parent(&self) -> Option<Rc<dyn Env>>

Source§

fn get(&self, name: &str) -> Option<Slot>

Source§

fn set(&self, name: String, value: Slot)

Source§

impl Scope for CommonCore

Source§

fn core(&self) -> Rc<dyn Core>

Source§

fn scope(&self) -> Option<Rc<dyn Scope>>

Source§

fn get_fields(&self) -> Vec<Rc<Field>>

Source§

fn get_field(&self, name: &str) -> Option<Rc<Field>>

Source§

fn get_function( &self, name: &str, types: &[Rc<dyn Type>], ) -> Option<Rc<Function>>

Source§

fn get_type(&self, name: &str) -> Option<Rc<dyn Type>>

Source§

fn get_predicate(&self, name: &str) -> Option<Rc<Predicate>>

Source§

fn as_class(self: Rc<Self>) -> Option<Rc<dyn Class>>

Auto Trait Implementations§

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.