Trait Parsable

Source
pub trait Parsable<C: Context>: Sized {
    // Provided methods
    fn parse_symbol(_name: Box<str>, _context: &C) -> Result<Self> { ... }
    fn parse_list(_parser: &mut Parser, _context: &C) -> Result<Self> { ... }
}
Expand description

This trait needs to be implemented for every struct which can be parsed using the token parser.

Provided Methods§

Source

fn parse_symbol(_name: Box<str>, _context: &C) -> Result<Self>

When a symbol is found by the parser, this will be called.

Source

fn parse_list(_parser: &mut Parser, _context: &C) -> Result<Self>

When a subparser is found by the parser, this will be called.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementations on Foreign Types§

Source§

impl<C: Context> Parsable<C> for bool

Source§

fn parse_symbol(name: Box<str>, _context: &C) -> Result<Self>

Source§

impl<C: Context> Parsable<C> for f32

Source§

fn parse_symbol(name: Box<str>, _context: &C) -> Result<Self>

Source§

impl<C: Context> Parsable<C> for f64

Source§

fn parse_symbol(name: Box<str>, _context: &C) -> Result<Self>

Source§

impl<C: Context> Parsable<C> for i8

Source§

fn parse_symbol(name: Box<str>, _context: &C) -> Result<Self>

Source§

impl<C: Context> Parsable<C> for i16

Source§

fn parse_symbol(name: Box<str>, _context: &C) -> Result<Self>

Source§

impl<C: Context> Parsable<C> for i32

Source§

fn parse_symbol(name: Box<str>, _context: &C) -> Result<Self>

Source§

impl<C: Context> Parsable<C> for i64

Source§

fn parse_symbol(name: Box<str>, _context: &C) -> Result<Self>

Source§

impl<C: Context> Parsable<C> for i128

Source§

fn parse_symbol(name: Box<str>, _context: &C) -> Result<Self>

Source§

impl<C: Context> Parsable<C> for u8

Source§

fn parse_symbol(name: Box<str>, _context: &C) -> Result<Self>

Source§

impl<C: Context> Parsable<C> for u16

Source§

fn parse_symbol(name: Box<str>, _context: &C) -> Result<Self>

Source§

impl<C: Context> Parsable<C> for u32

Source§

fn parse_symbol(name: Box<str>, _context: &C) -> Result<Self>

Source§

impl<C: Context> Parsable<C> for u64

Source§

fn parse_symbol(name: Box<str>, _context: &C) -> Result<Self>

Source§

impl<C: Context> Parsable<C> for u128

Source§

fn parse_symbol(name: Box<str>, _context: &C) -> Result<Self>

Source§

impl<C: Context> Parsable<C> for usize

Source§

fn parse_symbol(name: Box<str>, _context: &C) -> Result<Self>

Source§

impl<C: Context> Parsable<C> for Box<str>

Source§

fn parse_symbol(name: Box<str>, _context: &C) -> Result<Self>

Source§

impl<C: Context> Parsable<C> for String

Source§

fn parse_symbol(name: Box<str>, _context: &C) -> Result<Self>

Source§

impl<C: Context, T: Parsable<C>> Parsable<C> for Box<T>

Source§

fn parse_symbol(name: Box<str>, context: &C) -> Result<Self>

Source§

fn parse_list(parser: &mut Parser, context: &C) -> Result<Self>

Source§

impl<C: Context, T: Parsable<C>> Parsable<C> for Vec<T>

Source§

fn parse_list(parser: &mut Parser, context: &C) -> Result<Self>

Implementors§