css_parse/traits/
build.rs

1use crate::{Cursor, Parser};
2
3/// This trait allows AST nodes to construct themselves from a single Cursor from the [Parser].
4///
5/// AST nodes that implement this should be able to infallably construct themsevles from the given cursor. It's likely
6/// they'll need to implement [Peek][crate::Peek] to complete the contract: any AST node returning `true` from
7/// [Peek][crate::Peek] should be able to parse the first token, and given this is a single token Node,
8/// [Peek][crate::Peek] effectively demonstrates it can construct itself completely, when true.
9pub trait Build<'a>: Sized {
10	fn build(p: &Parser<'a>, c: Cursor) -> Self;
11}