[−][src]Enum aoc_utils::BufferedInput
Wraps the input source to an AOC problem. Handles cmdline arguments.
Supports input from a given file as well as from STDIN.
Implements std::io::BufRead
for the convenience of the BufRead::lines
iterator.
Example
If your executable is named prog
and the description is "Example description",
then the help (prog --help
) will look like this:
Example description
USAGE:
prog [FILE]
FLAGS:
-h, --help Prints help information
-V, --version Prints version information
ARGS:
<FILE> Input file (defaults to STDIN if not provided)
Variants
Implementations
impl BufferedInput
[src]
pub fn parse_args(description: &str) -> Result<Self>
[src]
Parse cmdline arguments and create a new object to read lines from an arbitrary input source.
The application optionally expects a path argument that specifies the file to read from. If not present, the input is read from STDIN.
Arguments
description
- provides an "about" section in the usage manual.
Example
use std::io::BufRead; use aoc_utils::BufferedInput; let input = BufferedInput::parse_args("Example solution").unwrap(); let lines: Vec<String> = input.lines().map(Result::unwrap).collect();
pub fn unwrapped_lines(self) -> impl Iterator<Item = String>
[src]
Returns an iterator over the lines of the input that panics when an error occurs.
Trait Implementations
impl BufRead for BufferedInput
[src]
fn fill_buf(&mut self) -> Result<&[u8]>
[src]
fn consume(&mut self, amt: usize)
[src]
fn read_until(&mut self, byte: u8, buf: &mut Vec<u8>) -> Result<usize, Error>
1.0.0[src]
fn read_line(&mut self, buf: &mut String) -> Result<usize, Error>
1.0.0[src]
fn split(self, byte: u8) -> Split<Self>
1.0.0[src]
fn lines(self) -> Lines<Self>
1.0.0[src]
impl Read for BufferedInput
[src]
fn read(&mut self, buf: &mut [u8]) -> Result<usize>
[src]
fn read_vectored(&mut self, bufs: &mut [IoSliceMut]) -> Result<usize, Error>
1.36.0[src]
fn is_read_vectored(&self) -> bool
[src]
unsafe fn initializer(&self) -> Initializer
[src]
fn read_to_end(&mut self, buf: &mut Vec<u8>) -> Result<usize, Error>
1.0.0[src]
fn read_to_string(&mut self, buf: &mut String) -> Result<usize, Error>
1.0.0[src]
fn read_exact(&mut self, buf: &mut [u8]) -> Result<(), Error>
1.6.0[src]
fn by_ref(&mut self) -> &mut Self
1.0.0[src]
fn bytes(self) -> Bytes<Self>
1.0.0[src]
fn chain<R>(self, next: R) -> Chain<Self, R> where
R: Read,
1.0.0[src]
R: Read,
fn take(self, limit: u64) -> Take<Self>
1.0.0[src]
Auto Trait Implementations
impl RefUnwindSafe for BufferedInput
impl Send for BufferedInput
impl Sync for BufferedInput
impl Unpin for BufferedInput
impl UnwindSafe for BufferedInput
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,