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
impl PreparedRawSegment
Sourcepub fn new(
body: DynSegment,
arguments: &[ValueType],
result: &ValueType,
) -> Result<PreparedRawSegment, Error>
pub fn new( body: DynSegment, arguments: &[ValueType], result: &ValueType, ) -> Result<PreparedRawSegment, Error>
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);Sourcepub unsafe fn call(
&mut self,
arguments: &[*const u8],
) -> Result<OwnedValue, Error>
pub unsafe fn call( &mut self, arguments: &[*const u8], ) -> Result<OwnedValue, Error>
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§
impl Freeze for PreparedRawSegment
impl RefUnwindSafe for PreparedRawSegment
impl Send for PreparedRawSegment
impl Sync for PreparedRawSegment
impl Unpin for PreparedRawSegment
impl UnsafeUnpin for PreparedRawSegment
impl UnwindSafe for PreparedRawSegment
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