pub struct Passdata<'s> { /* private fields */ }Expand description
Data for the logic program.
Implementations§
Source§impl<'s> Passdata<'s>
impl<'s> Passdata<'s>
Sourcepub const unsafe fn new_unchecked(schema: &'s Schema<'s>, data: Vec<u8>) -> Self
pub const unsafe fn new_unchecked(schema: &'s Schema<'s>, data: Vec<u8>) -> Self
Sourcepub const fn with_schema(schema: &'s Schema<'s>) -> Self
pub const fn with_schema(schema: &'s Schema<'s>) -> Self
Constructs with the given schema and empty data.
Sourcepub fn into_inner(self) -> Vec<u8> ⓘ
pub fn into_inner(self) -> Vec<u8> ⓘ
Returns the underlying encoded data.
Sourcepub fn predicates_iter(&self) -> impl Iterator<Item = &str> + '_
pub fn predicates_iter(&self) -> impl Iterator<Item = &str> + '_
Iterator over predicates.
Sourcepub fn edb_iter(
&self,
predicate: &str,
) -> Result<impl Iterator<Item = FactTerms<'_>> + '_>
pub fn edb_iter( &self, predicate: &str, ) -> Result<impl Iterator<Item = FactTerms<'_>> + '_>
Sourcepub fn add_fact<'a, T>(&mut self, predicate: &str, constants: T) -> Result<()>where
T: IntoArray<Constant<'a>>,
<T as IntoArray<Constant<'a>>>::Length: ArrayLength<ConstantTy> + ArrayLength<ConstantId>,
pub fn add_fact<'a, T>(&mut self, predicate: &str, constants: T) -> Result<()>where
T: IntoArray<Constant<'a>>,
<T as IntoArray<Constant<'a>>>::Length: ArrayLength<ConstantTy> + ArrayLength<ConstantId>,
Add a fact explicitly.
§Errors
Returns an error if the values do not match the expected types for the predicate.
Sourcepub fn query_edb<'a, T>(
&'a self,
predicate: &str,
values: T,
) -> Result<impl Iterator<Item = T::ResultTy> + 'a>where
T: QueryResult<'a> + 'a,
pub fn query_edb<'a, T>(
&'a self,
predicate: &str,
values: T,
) -> Result<impl Iterator<Item = T::ResultTy> + 'a>where
T: QueryResult<'a> + 'a,
Query for an explictly declared fact.
§Errors
If the expected types are not compatible with the types in the data.
Sourcepub fn contains_edb<'a, T>(&'a self, pred: &str, values: T) -> Result<bool>where
T: QueryResult<'a> + 'a,
pub fn contains_edb<'a, T>(&'a self, pred: &str, values: T) -> Result<bool>where
T: QueryResult<'a> + 'a,
Determines if there is any explicitly declared fact which matches the given parameters.
§Errors
If the expected types are not compatible with the types in the data.
Sourcepub fn query_only_one_edb<'a, T>(
&'a self,
pred: &str,
values: T,
) -> Result<Option<T::ResultTy>>where
T: QueryResult<'a> + 'a,
pub fn query_only_one_edb<'a, T>(
&'a self,
pred: &str,
values: T,
) -> Result<Option<T::ResultTy>>where
T: QueryResult<'a> + 'a,
Queries the data for an explicitly declared fact, and only returns a success if there is a single matching fact.
§Errors
- If the expected types are not compatible with the types in the data.
- If there are multiple matching facts
Trait Implementations§
Auto Trait Implementations§
impl<'s> Freeze for Passdata<'s>
impl<'s> RefUnwindSafe for Passdata<'s>
impl<'s> Send for Passdata<'s>
impl<'s> Sync for Passdata<'s>
impl<'s> Unpin for Passdata<'s>
impl<'s> UnwindSafe for Passdata<'s>
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
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more