[][src]Struct proteus::parser::Parser

pub struct Parser {}

This type represents a set of static methods for parsing transformation syntax into Action's.

The parser is responsible for parsing the transformation action specific syntax, take the following source syntax: join(" ", const("Mr."), first_name, last_name) the parser knows how to breakdown the syntax into a join action which calls the const action, and 2 getter actions and joins those actions results.

Actions currently supported include:

  • const eg. const(<value>)
  • join eg. `join(<separator, )

Implementations

impl Parser[src]

pub fn add_action_parser(
    name: &str,
    f: &'static ActionParserFn
) -> Result<(), Error>
[src]

add_action_parser adds an Action parsing function to dynamically be parsed. NOTE: this WILL overwrite any pre-existing functions with the same name.

name only accepts ASCII letters, numbers and _ equivalent to [a-zA-Z0-9_].

pub fn parse(source: &str, destination: &str) -> Result<Box<dyn Action>, Error>[src]

parses a single transformation action to be taken with the provided source & destination.

pub fn parse_multi(
    parsables: &[Parsable<'_>]
) -> Result<Vec<Box<dyn Action>>, Error>
[src]

parses a set of transformation actions into Action's.

pub fn parse_multi_from_str(s: &str) -> Result<Vec<Box<dyn Action>>, Error>[src]

parses a set of transformation actions into Action's from a JSON string of serialized Parsable structs.

pub fn parse_action(source: &str) -> Result<Box<dyn Action>, Error>[src]

parses an Action given the provided str. This is primarily used as a helper in custom Action Parsers.

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.