Struct file_scanner::Scanner [] [src]

pub struct Scanner<R: Read + Sized> { /* fields omitted */ }

Rust implementation of java.util.Scanner

Methods

impl<R: Read + Sized> Scanner<R>
[src]

Implements the meta-methods of Scanner that affect how the data stream is processed, e.g., delimiter, parsing radix, etc.

[src]

Sets the delimiter to be some pre-compiled regex and return it for behavioral consistency.

[src]

Sets the delimiter to be a string literal. The resulting delimiting expression is guaranteed to only interpret the literal passed in, i.e., this method cannot be used to simultaneously compile and set an arbitrary regular expression.

We return the compiled delimiting expression.

[src]

Return the delimiter for Scanner.next() and methods that depend on it.

[src]

Sets the radix in which numbers are parsed. This value must be on the closed range [2, 36], such that alphabet characters represent values greater than 9 in bases exceeding 10.

We return the postcondition value of the radix, which is the input if the input is within the valid range or the precondition value otherwise.

[src]

Retrieve the radix on which we perform numeric parsing.

impl<R: Read + Sized> Scanner<R>
[src]

Implements the methods of Scanner that affect the underlying data stream

[src]

Creates a new instance of Scanner on some object implementing Read

[src]

Creates a new instance of Scanner using a BufReader with a specified buffer size.

This instantiator allows the user to specify the capacity of the buffer. Its primary use-case is unit testing this module, i.e., it would be cumbersome to write 64KB test strings so one might specify a capacity of only a few bytes in order to test what happens at the

[src]

Returns Some(String) containing the next string if there is one. Otherwise returns None.

We first consume all leading delims that fit within the buffer of the underlying BufRead, then attempt to read everything until (but excluding) the next delim which is entirely contained within a single buffer. We guarantee this will behave as expected if the longest single precendent delimiter is no larger than the size of the buffer.

Otherwise it will fail.

[src]

Read up to (but excluding) the next \n character. If there are any leading delims, they will be included in the returned string.

NOTE: unlike next() we do consume the trailing \n, if it exists.

[src]

Attempts to retrieve the next integer of the specified (or inferred) type. Even if this fails, we still consume next.

The default radix for this parsing is 10, but users may specify a one-time arbitrary radix using Scanner.next_int_radix(u32) or persistently using Scanner.set_radix(u32).

[src]

Returns the next integer in some arbitrary base on [2, 36].

If the radix provided is outside of this range, we do nothing. Otherwise, we will consume next() even if it is not a valid integer.

NOTE: If one means to repeatedly parse in a fixed, arbitrary base, it is more efficient to use Scanner.set_radix(u32) followed by Scanner.next_int with no radix argument.

[src]

Attempts to retrieve the next floating-point number of the specified (or inferred) type. Even if this fails, we still consume next.

Note that this method is based on Scanner.next(), so the delimiter is still the same.

[src]

Returns the next float in some arbitrary base on [2, 36].

If the radix provided is outside of this range, we do nothing. Otherwise, we will consume next() even if it is not a valid integer.

NOTE: If one means to repeatedly parse in a fixed, arbitrary base, it is more efficient to use Scanner.set_radix(u32) followed by Scanner.next_float with no radix argument.