Struct grab::parsers::Stdin[][src]

pub struct Stdin { /* fields omitted */ }

A construct for handling the parsing of a given input string and determining if the program’s stdin should be called in leu of. By default, it will only indicate stdin should be used if the given input is a single dash (‘-’), with no other input.

Implementations

impl Stdin[src]

pub const DEFAULT_WEIGHT: u8[src]

The default weighting for Stdin

pub const DEFAULT_MARKER: &'static str[src]

Default marker for Stdin

pub const DEFAULT_PARSER: for<'a, 'b> fn(_: &'a str, _: &'b str) -> Result<(&'a str, ()), Err<Error<I>>>[src]

Default parser implementation for Stdin

pub fn new() -> Self[src]

Instantiate a new Stdin parser with sensible defaults

pub fn with<F>(self, f: F) -> Self where
    F: FnMut(&mut Self) -> &mut Self, 
[src]

Convenience function for modifying the semantics of this parser

Example:

use grab::parsers::Stdin;

// Use a 'curl --data' styled stdin
let stdin = Stdin::new().with(|this| this.marker("@-"));

pub fn marker(&mut self, marker: impl AsRef<str>) -> &mut Self[src]

Modify the marker string for triggering this Stdin parser. This marker is passed to the parser function as the second &str argument.

pub fn parser(
    &mut self,
    parser: for<'a, 'b> fn(_: &'a str, _: &'b str) -> Result<(&'a str, ()), Err<Error<I>>>
) -> &mut Self
[src]

Replace the parser for this Stdin with a different one. Expects a function (not closure) with the following arguments + return:

fn my_parser<’a, ’b>(input: &’a str, marker: &’b str) -> crate::nom::IResult<&’a str, ()> { /* … */ }

pub fn weight(&mut self, weight: u8) -> &mut Self[src]

Set this parser’s weight. Lower numbers will be ran before greater.

Trait Implementations

impl Clone for Stdin[src]

impl Debug for Stdin[src]

impl Default for Stdin[src]

Auto Trait Implementations

impl RefUnwindSafe for Stdin

impl Send for Stdin

impl Sync for Stdin

impl Unpin for Stdin

impl UnwindSafe for Stdin

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> Conv for T

impl<T> Conv for T

impl<T> FmtForward for T

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> Pipe for T where
    T: ?Sized

impl<T> Pipe for T

impl<T> PipeAsRef for T

impl<T> PipeBorrow for T

impl<T> PipeDeref for T

impl<T> PipeRef for T

impl<T> Tap for T

impl<T> Tap for T

impl<T, U> TapAsRef<U> for T where
    U: ?Sized

impl<T, U> TapBorrow<U> for T where
    U: ?Sized

impl<T> TapDeref for T

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T> TryConv for T

impl<T> TryConv for T

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.