Skip to main content

InputStream

Trait InputStream 

Source
pub trait InputStream
where for<'a> Self: StreamIsPartial + Stream + Compare<char> + AsRef<[u8]> + Compare<Caseless<&'a str>> + Compare<&'a str>,
{ type Str: Clone + AsRef<str> + Into<String> + Into<Box<str>>; // Required methods fn try_into_str( slice: &Self::Slice, ) -> Result<Self::Str, CalendarParseError<Self::Slice>>; fn try_into_string( slice: &Self::Slice, ) -> Result<String, CalendarParseError<Self::Slice>>; fn as_bytes(slice: &Self::Slice) -> &[u8] ⓘ; fn str_from_static_str(s: &'static str) -> Self::Str; fn strip_line_fold_prefix(&mut self) -> usize; fn next_contiguous_slice<E>(input: &mut Self) -> Result<Self::Slice, E> where E: ParserError<Self>; }
Expand description

An input stream compatible with the parsers in calico::parser.

Required Associated Types§

Required Methods§

Source

fn try_into_str( slice: &Self::Slice, ) -> Result<Self::Str, CalendarParseError<Self::Slice>>

Source

fn try_into_string( slice: &Self::Slice, ) -> Result<String, CalendarParseError<Self::Slice>>

Source

fn as_bytes(slice: &Self::Slice) -> &[u8] ⓘ

Source

fn str_from_static_str(s: &'static str) -> Self::Str

Source

fn strip_line_fold_prefix(&mut self) -> usize

Removes as many line folds from the prefix of self as possible, and returns the number of bytes removed (this will always be a multiple of three).

Source

fn next_contiguous_slice<E>(input: &mut Self) -> Result<Self::Slice, E>
where E: ParserError<Self>,

Returns the longest contiguous prefix of self. A slice is contiguous if it does not contain line folds or newlines. If the input does not contain the sequence \r\n anywhere, the entire input is returned as a slice.

Dyn Compatibility§

This trait is not dyn compatible.

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

Implementations on Foreign Types§

Source§

impl InputStream for &str

Source§

type Str = &str

Source§

fn try_into_str( slice: &Self::Slice, ) -> Result<Self::Str, CalendarParseError<Self::Slice>>

Source§

fn try_into_string( slice: &Self::Slice, ) -> Result<String, CalendarParseError<Self::Slice>>

Source§

fn as_bytes(slice: &Self::Slice) -> &[u8] ⓘ

Source§

fn str_from_static_str(s: &'static str) -> Self::Str

Source§

fn strip_line_fold_prefix(&mut self) -> usize

Source§

fn next_contiguous_slice<E>(input: &mut Self) -> Result<Self::Slice, E>
where E: ParserError<Self>,

Source§

impl<'a> InputStream for &'a [u8]

Source§

type Str = &'a str

Source§

fn try_into_str( slice: &Self::Slice, ) -> Result<Self::Str, CalendarParseError<Self::Slice>>

Source§

fn try_into_string( slice: &Self::Slice, ) -> Result<String, CalendarParseError<Self::Slice>>

Source§

fn as_bytes(slice: &Self::Slice) -> &[u8] ⓘ

Source§

fn str_from_static_str(s: &'static str) -> Self::Str

Source§

fn strip_line_fold_prefix(&mut self) -> usize

Source§

fn next_contiguous_slice<E>(input: &mut Self) -> Result<Self::Slice, E>
where E: ParserError<Self>,

Implementors§

Source§

impl<'a> InputStream for Escaped<'a>

Source§

type Str = Cow<'a, str>