In

Struct In 

Source
pub struct In<B: BufRead> { /* private fields */ }
Expand description

General Input (stdin, file, socket, etc.).

Implementations§

Source§

impl<B: BufRead> In<B>

Source

pub fn new(bufread: B) -> Self

Creates a new instance of BaseInput.

Source

pub fn is_empty(&mut self) -> bool

Returns true if the input stream has more data, returns false otherwise.

Source

pub fn read_int<T>(&mut self) -> Result<T>
where T: PrimInt + FromStr,

Reads an integer from the input stream.

The integer type is one of i8, i16, i32, i64, i128, isize, u8, u16, u32, u64, u128, or usize.

§Errors

Same as Scanner::next_int.

Source

pub fn read_float<T>(&mut self) -> Result<T>
where T: PrimFloat + FromStr,

Reads a floating point number from the input stream.

The integer type is one of f32 or f64.

§Errors

Same as Scanner::next_float.

Source

pub fn read_all_ints<T>(&mut self) -> Result<Vec<T>>
where T: PrimInt + FromStr,

Reads all integers from the input stream using the internal scanner, consuming all the content in the input stream, reading the content in a token-by-token streaming mode.

§Errors

Same as Scanner::next_int.

Source

pub fn read_string(&mut self) -> Result<String>

Read a string token from the input stream.

§Errors

Same as Scanner::next_token.

Source

pub fn read_all_strings(&mut self) -> Result<Vec<String>>

Reads all string tokens from the input stream using the internal scanner, consuming all the content in the input stream, reading the content in a token-by-token streaming mode.

§Errors

Same as Scanner::next_token.

Auto Trait Implementations§

§

impl<B> Freeze for In<B>
where B: Freeze,

§

impl<B> RefUnwindSafe for In<B>
where B: RefUnwindSafe,

§

impl<B> Send for In<B>
where B: Send,

§

impl<B> Sync for In<B>
where B: Sync,

§

impl<B> Unpin for In<B>
where B: Unpin,

§

impl<B> UnwindSafe for In<B>
where B: UnwindSafe,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

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

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.