ExactSizeInput

Trait ExactSizeInput 

Source
pub trait ExactSizeInput<'src>: Input<'src> {
    // Required method
    unsafe fn span_from(
        cache: &mut Self::Cache,
        range: RangeFrom<&Self::Cursor>,
    ) -> Self::Span;
}
Expand description

Implemented by inputs that have a known size.

In this case, ‘size’ means ‘number of generated tokens/spans’. You can think of this trait as filling the same niche as ExactSizeIterator.

Required Methods§

Source

unsafe fn span_from( cache: &mut Self::Cache, range: RangeFrom<&Self::Cursor>, ) -> Self::Span

Get a span from a start cursor to the end of the input.

§Safety

As with functions on Input, the cursors provided must be generated by this input.

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<'src> ExactSizeInput<'src> for &'src str

Source§

unsafe fn span_from( this: &mut Self::Cache, range: RangeFrom<&Self::Cursor>, ) -> Self::Span

Source§

impl<'src> ExactSizeInput<'src> for Bytes

Available on crate feature bytes only.
Source§

unsafe fn span_from( this: &mut Self::Cache, range: RangeFrom<&Self::Cursor>, ) -> Self::Span

Source§

impl<'src, T> ExactSizeInput<'src> for &'src [T]

Source§

unsafe fn span_from( this: &mut Self::Cache, range: RangeFrom<&Self::Cursor>, ) -> Self::Span

Source§

impl<'src, T: 'src, const N: usize> ExactSizeInput<'src> for &'src [T; N]

Source§

unsafe fn span_from( this: &mut Self::Cache, range: RangeFrom<&Self::Cursor>, ) -> Self::Span

Implementors§

Source§

impl<'src> ExactSizeInput<'src> for &'src Graphemes

Source§

impl<'src, I: ExactSizeIterator + 'src> ExactSizeInput<'src> for Stream<I>
where I::Item: Clone,

Source§

impl<'src, S, I> ExactSizeInput<'src> for WithContext<S, I>
where I: ExactSizeInput<'src> + Input<'src>, S: Span + Clone + 'src, S::Context: Clone + 'src, S::Offset: From<<I::Span as Span>::Offset>,

Source§

impl<'src, S, I, F> ExactSizeInput<'src> for MappedSpan<S, I, F>
where I: ExactSizeInput<'src> + Input<'src>, S: Span + Clone + 'src, S::Context: Clone + 'src, S::Offset: From<<I::Span as Span>::Offset>, F: Fn(I::Span) -> S + 'src,

Source§

impl<'src, T, S, I, F> ExactSizeInput<'src> for MappedInput<'src, T, S, I, F>
where I: ExactSizeInput<'src>, T: 'src, S: Span + Clone + 'src, F: Fn(I::MaybeToken) -> (<I::MaybeToken as IntoMaybe<'src, I::Token>>::Proj<T>, <I::MaybeToken as IntoMaybe<'src, I::Token>>::Proj<S>) + 'src,