Skip to main content

AdamCheckingEnvironment

Struct AdamCheckingEnvironment 

Source
pub struct AdamCheckingEnvironment { /* private fields */ }
Expand description

Owns CEL checking facts and explicit Adam-registered storage leaves.

Membership IDs belong to the inner CEL catalog, are unique, and are sorted. CEL capabilities and type-function results never imply Adam membership.

§Examples

let environment = adam_lang::checking_environment(
    &adam_lang::TypeRegistry::new(), &cel_parser::OpLookup::new()).unwrap();
assert!(environment.cel().resolve_type("i32").is_some());
assert!(!environment.cell_types().is_empty());

Implementations§

Source§

impl AdamCheckingEnvironment

Source

pub fn from_parts( cel: CheckingEnvironment, cell_types: Vec<u32>, ) -> Result<Self, MetadataError>

Owns the catalog and sorts explicitly supplied Adam leaf membership.

§Errors

Rejects duplicate IDs and IDs absent from the CEL catalog.

  • Complexity: Expected O(n + m log(m + 1)) time and O(n + m) space for n catalog leaves and m membership IDs, including owned membership storage.
§Examples
use adam_lang::checking::AdamCheckingEnvironment;
let cel = cel_parser::checking::CheckingBuilder::new().finish().unwrap();
let environment = AdamCheckingEnvironment::from_parts(cel, vec![]).unwrap();
assert!(environment.cell_types().is_empty());
Source

pub fn cel(&self) -> &CheckingEnvironment

Borrows the CEL catalog used by expression checks and native bindings.

§Examples

See the type example.

Source

pub fn cell_types(&self) -> &[u32]

Borrows the sorted, explicitly registered Adam leaf IDs.

§Examples

See the type example.

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> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

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.