Struct polar_core::terms::Term
source · [−]pub struct Term { /* private fields */ }
Expand description
Represents a concrete instance of a Polar value
Implementations
sourceimpl Term
impl Term
sourcepub fn disjunctive_normal_form(&self) -> Self
pub fn disjunctive_normal_form(&self) -> Self
convert expression to disjunctive normal form
sourcepub fn conjunctive_normal_form(&self) -> Self
pub fn conjunctive_normal_form(&self) -> Self
convert expression to conjunctive normal form
sourceimpl Term
impl Term
sourcepub fn new_temporary(value: Value) -> Self
pub fn new_temporary(value: Value) -> Self
Creates a new term for a temporary variable
sourcepub fn new_from_ffi(value: Value) -> Self
pub fn new_from_ffi(value: Value) -> Self
Creates a new term from across the FFI boundary
sourcepub fn new_from_parser(
source: Arc<Source>,
left: usize,
right: usize,
value: Value
) -> Self
pub fn new_from_parser(
source: Arc<Source>,
left: usize,
right: usize,
value: Value
) -> Self
Creates a new term from the parser
sourcepub fn new_from_test(value: Value) -> Self
pub fn new_from_test(value: Value) -> Self
Creates a new term from a test value
sourcepub fn clone_with_value(&self, value: Value) -> Self
pub fn clone_with_value(&self, value: Value) -> Self
Create a new Term, cloning the source info of self
but with the new value
sourcepub fn replace_value(&mut self, value: Value)
pub fn replace_value(&mut self, value: Value)
Replace the value
of self
pub fn as_expression(&self) -> PolarResult<&Operation>
pub fn as_list(&self) -> PolarResult<&TermList>
pub fn as_dict(&self) -> PolarResult<&Dictionary>
sourcepub fn mut_value(&mut self) -> &mut Value
pub fn mut_value(&mut self) -> &mut Value
Get a mutable reference to the underlying data. This will be a real mut pointer if there is only one term with an Arc to the value, otherwise it will be a clone.
pub fn is_ground(&self) -> bool
sourcepub fn variables(&self, vars: &mut HashSet<Symbol>)
pub fn variables(&self, vars: &mut HashSet<Symbol>)
Get a set of all the variables used within a term.
sourcepub fn contains_variable(&self, var: &Symbol) -> bool
pub fn contains_variable(&self, var: &Symbol) -> bool
Does the given variable occur in this term? Should be much faster than accumulating the set and checking.
pub fn hash_value(&self) -> u64
pub fn is_actor_union(&self) -> bool
pub fn is_resource_union(&self) -> bool
Trait Implementations
sourceimpl<'de> Deserialize<'de> for Term
impl<'de> Deserialize<'de> for Term
sourcefn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error> where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error> where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
sourceimpl From<Term> for Constraint
impl From<Term> for Constraint
impl Eq for Term
Auto Trait Implementations
impl RefUnwindSafe for Term
impl Send for Term
impl Sync for Term
impl Unpin for Term
impl UnwindSafe for Term
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more