Skip to main content

ResolvedType

Enum ResolvedType 

Source
pub enum ResolvedType {
    Scalar(ResolvedLeafType),
    Array {
        element: Box<ResolvedType>,
    },
    Tuple {
        elements: Vec<ResolvedType>,
    },
    Callable {
        parameters: Vec<ResolvedType>,
        result: Box<ResolvedType>,
    },
}
Expand description

A resolved recursive CEL type expression.

Variants§

§

Scalar(ResolvedLeafType)

A resolved scalar leaf.

§

Array

A resolved array type.

Fields

§element: Box<ResolvedType>

The resolved element type.

§

Tuple

A resolved tuple type.

Fields

§elements: Vec<ResolvedType>

The resolved tuple element types, in source order.

§

Callable

A callable’s source-ordered parameters and single result.

Fields

§parameters: Vec<ResolvedType>

The complete parameter types.

§result: Box<ResolvedType>

The complete result type.

Implementations§

Source§

impl ResolvedType

Source

pub fn into_value_type(self) -> Result<ValueType>

Consumes a complete source type and returns its canonical runtime descriptor.

§Errors

Returns an error for unavailable leaf factories or unrepresentable tuple layouts.

  • Complexity: O(n) in recursive type nodes.
§Examples
use cel_parser::ResolvedType;
assert!(ResolvedType::Tuple { elements: vec![] }.into_value_type().is_ok());
Source

pub fn complete_value_type(&self) -> Result<ValueType>

Builds canonical recursive metadata for interpreter storage.

Empty tuples describe source unit, not an opaque host ().

§Errors

Returns an error for missing leaf factories or an unrepresentable tuple layout.

  • Complexity: O(n) time and output space for n recursive type nodes.
§Examples
use cel_parser::ResolvedType;
use cel_runtime::value_type::{Nil, ValueRepr};
assert!(ResolvedType::Tuple { elements: vec![] }
    .complete_value_type().unwrap().same_shape(&Nil::value_type()));
Source

pub fn display_name(&self) -> String

Returns a human-readable name for this resolved type.

  • Complexity: O(n) in the number of nodes in this type tree.

Trait Implementations§

Source§

impl Clone for ResolvedType

Source§

fn clone(&self) -> ResolvedType

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for ResolvedType

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl From<ResolvedLeafType> for ResolvedType

Source§

fn from(leaf: ResolvedLeafType) -> Self

Promotes a registered leaf without changing its identity.

Source§

impl PartialEq for ResolvedType

Source§

fn eq(&self, other: &ResolvedType) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for ResolvedType

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
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.