Skip to main content

Parser

Struct Parser 

Source
pub struct Parser<F: EvalContextFamily> { /* private fields */ }
Expand description

OTTL Parser that parses input strings and produces executable objects. Paths are resolved at parse time (not at execution time) for maximum performance.

The type parameter F is the EvalContextFamily that determines the concrete evaluation context type used at execution time.

Implementations§

Source§

impl<F: EvalContextFamily> Parser<F>

Source

pub fn new( editors_map: &CallbackMap, converters_map: &CallbackMap, enums_map: &EnumMap, path_resolvers: &PathResolverMap<F>, expression: &str, ) -> Self

Creates a new parser with the given configuration. Each path that appears in the expression must have a corresponding entry in path_resolvers; otherwise parsing fails with an error.

Trait Implementations§

Source§

impl<F: EvalContextFamily> OttlParser<F> for Parser<F>

Implementation of the OttlParser trait for Parser.

Source§

fn is_error(&self) -> Result<()>

Checks if the parser encountered any errors during creation. Read more
Source§

fn execute<'a>(&self, ctx: &mut F::Context<'a>) -> Result<Value>

Executes this OTTL statement with the given context. Read more

Auto Trait Implementations§

§

impl<F> Freeze for Parser<F>

§

impl<F> !RefUnwindSafe for Parser<F>

§

impl<F> Send for Parser<F>
where F: Send,

§

impl<F> Sync for Parser<F>
where F: Sync,

§

impl<F> Unpin for Parser<F>
where F: Unpin,

§

impl<F> UnsafeUnpin for Parser<F>

§

impl<F> !UnwindSafe for Parser<F>

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<'src, T> IntoMaybe<'src, T> for T
where T: 'src,

Source§

type Proj<U: 'src> = U

Source§

fn map_maybe<R>( self, _f: impl FnOnce(&'src T) -> &'src R, g: impl FnOnce(T) -> R, ) -> <T as IntoMaybe<'src, T>>::Proj<R>
where R: 'src,

Source§

impl<T, S> SpanWrap<S> for T
where S: WrappingSpan<T>,

Source§

fn with_span(self, span: S) -> <S as WrappingSpan<Self>>::Spanned

Invokes WrappingSpan::make_wrapped to wrap an AST node in a span.
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.