Skip to main content

Parse

Trait Parse 

Source
pub trait Parse: Sized {
    // Required method
    fn parse(input: &ParseStream<'_>) -> Result<Self>;
}
Expand description

A trait for types that can be parsed from a ParseStream.

This is the core parsing trait, analogous to syn’s Parse trait.

§Example

use java_lang::{Parse, ParseStream, parse_str, Ident};

struct SimpleName {
    name: Ident,
}

impl Parse for SimpleName {
    fn parse(input: &ParseStream) -> java_lang::Result<Self> {
        Ok(SimpleName {
            name: input.parse_ident()?,
        })
    }
}

Required Methods§

Source

fn parse(input: &ParseStream<'_>) -> Result<Self>

Parse this type from the given ParseStream.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§