pub struct ValueFormatter { /* private fields */ }Expand description
Binds recursive debug capabilities independently of a value’s ownership.
The formatter never clones or consumes a value. Each checked formatting boundary validates the complete shape before invoking any leaf hook.
§Examples
use cel_runtime::{Leaf, OwnedValue, ValueType};
let value = OwnedValue::new::<Leaf<i32>>(7)
.with_value_type(ValueType::leaf::<i32>().with_debug::<Leaf<i32>>().unwrap()).unwrap();
let formatter = value.prepare_debug().unwrap();
assert_eq!(formatter.format(&value).unwrap(), "7");Implementations§
Source§impl ValueFormatter
impl ValueFormatter
Sourcepub fn format(&self, value: &OwnedValue) -> Result<String, Error>
pub fn format(&self, value: &OwnedValue) -> Result<String, Error>
Trait Implementations§
Source§impl Clone for ValueFormatter
impl Clone for ValueFormatter
Source§fn clone(&self) -> ValueFormatter
fn clone(&self) -> ValueFormatter
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for ValueFormatter
impl RefUnwindSafe for ValueFormatter
impl Send for ValueFormatter
impl Sync for ValueFormatter
impl Unpin for ValueFormatter
impl UnsafeUnpin for ValueFormatter
impl UnwindSafe for ValueFormatter
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