Skip to main content

PreparedRawSegment

Struct PreparedRawSegment 

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

Owns the same frozen raw engine as PreparedSegment with runtime-bound witnesses.

Hosts validate their storage adapters once, then lend exact canonical pointers.

Implementations§

Source§

impl PreparedRawSegment

Source

pub fn new( body: DynSegment, arguments: &[ValueType], result: &ValueType, ) -> Result<Self>

Binds every argument read and the complete result before any operation executes.

§Errors

Rejects dependent bodies, undeclared or mismatched reads, missing cloning, and a mismatched result.

  • Complexity: O(n) in descriptor nodes and emitted reads.
§Examples
use cel_runtime::{DynSegment, ValueType, prepared_segment::PreparedRawSegment};
let mut body = DynSegment::new::<()>();
body.just(7i32);
let mut body = PreparedRawSegment::new(body, &[], &ValueType::leaf::<i32>())?;
let result = unsafe { body.call(&[]) }?;
assert_eq!(result.try_into_typed::<cel_runtime::Leaf<i32>>()?, 7);
Source

pub unsafe fn call(&mut self, arguments: &[*const u8]) -> Result<OwnedValue>

Executes the bound raw frame without conversions or descriptor comparisons.

§Safety

arguments must have the prepared arity. Each pointer must borrow a live, aligned value of its exact preparation descriptor throughout this call. No pointer may alias mutable storage accessed by an operation.

§Errors

Propagates operation errors after frame cleanup.

  • Complexity: Body execution and emitted clone costs.
§Examples

See Self::new.

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 = 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.