Trait fastobo::parser::FromPair

source ·
pub trait FromPair<'i>: Sized {
    const RULE: Rule;

    // Required method
    unsafe fn from_pair_unchecked(
        pair: Pair<'i, Rule>,
        cache: &Cache
    ) -> Result<Self, SyntaxError>;

    // Provided method
    fn from_pair(
        pair: Pair<'i, Rule>,
        cache: &Cache
    ) -> Result<Self, SyntaxError> { ... }
}
Expand description

A trait for structures that can be parsed from a pest::Pair.

Required Associated Constants§

source

const RULE: Rule

The production rule the pair is expected to be obtained from.

Required Methods§

source

unsafe fn from_pair_unchecked( pair: Pair<'i, Rule>, cache: &Cache ) -> Result<Self, SyntaxError>

Create a new instance from a Pair without checking the rule.

Safety

May panic if the pair was not produced by the right rule, i.e. pair.as_rule() != <Self as FromPair>::RULE.

Provided Methods§

source

fn from_pair(pair: Pair<'i, Rule>, cache: &Cache) -> Result<Self, SyntaxError>

Create a new instance from a Pair.

Implementations on Foreign Types§

source§

impl<'i> FromPair<'i> for Cow<'i, UnquotedStr>

source§

const RULE: Rule = Rule::UnquotedString

source§

unsafe fn from_pair_unchecked( pair: Pair<'i, Rule>, cache: &Cache ) -> Result<Self, SyntaxError>

source§

impl<'i> FromPair<'i> for Cow<'i, QuotedStr>

source§

const RULE: Rule = Rule::QuotedString

source§

unsafe fn from_pair_unchecked( pair: Pair<'i, Rule>, cache: &Cache ) -> Result<Self, SyntaxError>

source§

impl<'i> FromPair<'i> for bool

source§

const RULE: Rule = Rule::Boolean

source§

unsafe fn from_pair_unchecked( pair: Pair<'i, Rule>, _cache: &Cache ) -> Result<Self, SyntaxError>

Implementors§

source§

impl<'i> FromPair<'i> for CreationDate

source§

const RULE: Rule = Rule::CreationDate

source§

impl<'i> FromPair<'i> for EntityFrame

source§

const RULE: Rule = Rule::EntityFrame

source§

impl<'i> FromPair<'i> for HeaderClause

source§

const RULE: Rule = Rule::HeaderClause

source§

impl<'i> FromPair<'i> for Ident

source§

const RULE: Rule = Rule::Id

source§

impl<'i> FromPair<'i> for Import

source§

const RULE: Rule = Rule::Import

source§

impl<'i> FromPair<'i> for InstanceClause

source§

const RULE: Rule = Rule::InstanceClause

source§

impl<'i> FromPair<'i> for IsoTimezone

source§

const RULE: Rule = Rule::Iso8601TimeZone

source§

impl<'i> FromPair<'i> for PropertyValue

source§

const RULE: Rule = Rule::PropertyValue

source§

impl<'i> FromPair<'i> for SynonymScope

source§

const RULE: Rule = Rule::SynonymScope

source§

impl<'i> FromPair<'i> for TermClause

source§

const RULE: Rule = Rule::TermClause

source§

impl<'i> FromPair<'i> for TypedefClause

source§

const RULE: Rule = Rule::TypedefClause

source§

impl<'i> FromPair<'i> for ClassIdent

source§

const RULE: Rule = Rule::ClassId

source§

impl<'i> FromPair<'i> for Comment

source§

const RULE: Rule = Rule::Comment

source§

impl<'i> FromPair<'i> for Definition

source§

const RULE: Rule = Rule::Definition

source§

impl<'i> FromPair<'i> for HeaderFrame

source§

const RULE: Rule = Rule::HeaderFrame

source§

impl<'i> FromPair<'i> for IdentPrefix

source§

const RULE: Rule = Rule::IdPrefix

source§

impl<'i> FromPair<'i> for InstanceFrame

source§

const RULE: Rule = Rule::InstanceFrame

source§

impl<'i> FromPair<'i> for InstanceIdent

source§

const RULE: Rule = Rule::InstanceId

source§

impl<'i> FromPair<'i> for IsoDate

source§

const RULE: Rule = Rule::Iso8601Date

source§

impl<'i> FromPair<'i> for IsoDateTime

source§

const RULE: Rule = Rule::Iso8601DateTime

source§

impl<'i> FromPair<'i> for IsoTime

source§

const RULE: Rule = Rule::Iso8601Time

source§

impl<'i> FromPair<'i> for Line<InstanceClause>

source§

const RULE: Rule = Rule::InstanceClauseLine

source§

impl<'i> FromPair<'i> for Line<TermClause>

source§

const RULE: Rule = Rule::TermClauseLine

source§

impl<'i> FromPair<'i> for Line<TypedefClause>

source§

const RULE: Rule = Rule::TypedefClauseLine

source§

impl<'i> FromPair<'i> for LiteralPropertyValue

source§

const RULE: Rule = Rule::LiteralPropertyValue

source§

impl<'i> FromPair<'i> for NaiveDateTime

source§

const RULE: Rule = Rule::NaiveDateTime

source§

impl<'i> FromPair<'i> for NamespaceIdent

source§

const RULE: Rule = Rule::NamespaceId

source§

impl<'i> FromPair<'i> for OboDoc

source§

const RULE: Rule = Rule::OboDoc

source§

impl<'i> FromPair<'i> for PrefixedIdent

source§

const RULE: Rule = Rule::PrefixedId

source§

impl<'i> FromPair<'i> for Qualifier

source§

const RULE: Rule = Rule::Qualifier

source§

impl<'i> FromPair<'i> for QualifierList

source§

const RULE: Rule = Rule::QualifierList

source§

impl<'i> FromPair<'i> for QuotedString

source§

const RULE: Rule = Rule::QuotedString

source§

impl<'i> FromPair<'i> for RelationIdent

source§

const RULE: Rule = Rule::RelationId

source§

impl<'i> FromPair<'i> for ResourcePropertyValue

source§

const RULE: Rule = Rule::ResourcePropertyValue

source§

impl<'i> FromPair<'i> for SubsetIdent

source§

const RULE: Rule = Rule::SubsetId

source§

impl<'i> FromPair<'i> for Synonym

source§

const RULE: Rule = Rule::Synonym

source§

impl<'i> FromPair<'i> for SynonymTypeIdent

source§

const RULE: Rule = Rule::SynonymTypeId

source§

impl<'i> FromPair<'i> for TermFrame

source§

const RULE: Rule = Rule::TermFrame

source§

impl<'i> FromPair<'i> for TypedefFrame

source§

const RULE: Rule = Rule::TypedefFrame

source§

impl<'i> FromPair<'i> for UnprefixedIdent

source§

const RULE: Rule = Rule::UnprefixedId

source§

impl<'i> FromPair<'i> for UnquotedString

source§

const RULE: Rule = Rule::UnquotedString

source§

impl<'i> FromPair<'i> for Url

source§

const RULE: Rule = Rule::Iri

source§

impl<'i> FromPair<'i> for Xref

source§

const RULE: Rule = Rule::Xref

source§

impl<'i> FromPair<'i> for XrefList

source§

const RULE: Rule = Rule::XrefList

source§

impl<'i> FromPair<'i> for Eol

source§

const RULE: Rule = Rule::EOL