Skip to main content

Nth

Trait Nth 

Source
pub trait Nth<'a>: Sized {
    const NTH_KINDSET: KindSet = _;

    // Required methods
    fn peek_odd<I>(p: &Parser<'a, I>, c: Cursor) -> bool
       where I: Iterator<Item = Cursor> + Clone;
    fn peek_even<I>(p: &Parser<'a, I>, c: Cursor) -> bool
       where I: Iterator<Item = Cursor> + Clone;
    fn build_odd(node: Ident) -> Self;
    fn build_even(node: Ident) -> Self;
    fn build_integer(node: Number) -> Self;
    fn build_anb(a: i32, b: i32, cursors: [Cursor; 4]) -> Self;

    // Provided methods
    fn anb_matches(a: i32, b: i32, index: i32) -> bool { ... }
    fn parse_nth<I>(p: &mut Parser<'a, I>) -> Result<Self>
       where I: Iterator<Item = Cursor> + Clone { ... }
}
Expand description

An <an+b> value, such as the 2n+1 of :nth-child(2n+1).

https://drafts.csswg.org/css-syntax-3/#anb-microsyntax

Provided Associated Constants§

Source

const NTH_KINDSET: KindSet = _

The set of Kinds that can start an <an+b> value.

Required Methods§

Source

fn peek_odd<I>(p: &Parser<'a, I>, c: Cursor) -> bool
where I: Iterator<Item = Cursor> + Clone,

Returns true if the cursor is the odd keyword.

Source

fn peek_even<I>(p: &Parser<'a, I>, c: Cursor) -> bool
where I: Iterator<Item = Cursor> + Clone,

Returns true if the cursor is the even keyword.

Source

fn build_odd(node: Ident) -> Self

Source

fn build_even(node: Ident) -> Self

Source

fn build_integer(node: Number) -> Self

Source

fn build_anb(a: i32, b: i32, cursors: [Cursor; 4]) -> Self

Provided Methods§

Source

fn anb_matches(a: i32, b: i32, index: i32) -> bool

Returns true if the 1-based index is one of the indices selected by an+b.

Source

fn parse_nth<I>(p: &mut Parser<'a, I>) -> Result<Self>
where I: Iterator<Item = Cursor> + Clone,

Dyn Compatibility§

This trait is not dyn compatible.

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

Implementors§