# Struct untrusted::Input [−] [src]

    pub struct Input<'a> { /* fields omitted */ }

A wrapper around `&'a [u8]` that helps in writing panic-free code.

No methods of `Input` will ever panic.

## Methods

### `impl<'a> Input<'a>`
[src]

#### `fn from(bytes: &'a [u8]) -> Input<'a>`

Construct a new `Input` for the given input `bytes`.

#### `fn is_empty(&self) -> bool`

Returns `true` if the input is empty and false otherwise.

#### `fn iter(&self) -> <&[u8] as IntoIterator>::IntoIter`

Returns an iterator over the input.

#### `fn len(&self) -> usize`

Returns the length of the `Input`.

#### `fn read_all<F, R, E>(&self, incomplete_read: E, read: F) -> Result<R, E> where
F: FnOnce(&mut Reader<'a>) -> Result<R, E>,`

Calls `read` with the given input as a `Reader`, ensuring that `read` consumed the entire input. If `read` does not consume the entire input, `incomplete_read` is returned.

#### `fn read_all_mut<F, R, E>(&self, incomplete_read: E, read: F) -> Result<R, E> where
F: FnMut(&mut Reader<'a>) -> Result<R, E>,`

Like `read_all`, except taking an `FnMut`.

#### `fn as_slice_less_safe(&self) -> &'a [u8]`

Access the input as a slice so it can be processed by functions that are not written using the Input/Reader framework.

## Trait Implementations

### `impl<'a> Clone for Input<'a>`
[src]

#### `fn clone(&self) -> Input<'a>`

Returns a copy of the value. Read more

#### `fn clone_from(&mut self, source: &Self)`
1.0.0

Performs copy-assignment from `source`. Read more

### `impl<'a> Copy for Input<'a>`
[src]

### `impl<'a> Debug for Input<'a>`
[src]

#### `fn fmt(&self, __arg_0: &mut Formatter) -> Result`

Formats the value using the given formatter.

### `impl<'a> Eq for Input<'a>`
[src]

### `impl<'a> PartialEq for Input<'a>`
[src]

#### `fn eq(&self, __arg_0: &Input<'a>) -> bool`

This method tests for `self` and `other` values to be equal, and is used by `==`. Read more

#### `fn ne(&self, __arg_0: &Input<'a>) -> bool`

This method tests for `!=`.

### `impl<'a, 'b> PartialEq<&'b [u8]> for Input<'a>`
[src]

#### `fn eq(&self, other: &&'b [u8]) -> bool`

This method tests for `self` and `other` values to be equal, and is used by `==`. Read more

#### `fn ne(&self, other: &Rhs) -> bool`
1.0.0

This method tests for `!=`.

# Help

## Keyboard Shortcuts

?
  Show this help dialog
S
  Focus the search field
⇤
  Move up in search results
⇥
  Move down in search results
⏎
  Go to active search result
+
  Collapse/expand all sections

## Search Tricks

Prefix searches with a type followed by a colon (e.g. `fn:`) to restrict the search to a given type.

Accepted types are: `fn`, `mod`, `struct`, `enum`, `trait`, `type`, `macro`, and `const`.

Search functions by type signature (e.g. `vec -> usize` or `* -> vec`)