[−][src]Struct untrusted::Input
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]
impl<'a> Input<'a>pub fn from(bytes: &'a [u8]) -> Input<'a>[src]
pub fn from(bytes: &'a [u8]) -> Input<'a>Construct a new Input for the given input bytes.
pub fn is_empty(&self) -> bool[src]
pub fn is_empty(&self) -> boolReturns true if the input is empty and false otherwise.
pub fn iter(&self) -> <&[u8] as IntoIterator>::IntoIter[src]
pub fn iter(&self) -> <&[u8] as IntoIterator>::IntoIterReturns an iterator over the input.
pub fn len(&self) -> usize[src]
pub fn len(&self) -> usizeReturns the length of the Input.
pub fn read_all<F, R, E>(&self, incomplete_read: E, read: F) -> Result<R, E> where
F: FnOnce(&mut Reader<'a>) -> Result<R, E>, [src]
pub 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.
pub 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>, [src]
pub 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.
pub fn as_slice_less_safe(&self) -> &'a [u8][src]
pub 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> Debug for Input<'a>[src]
impl<'a> Debug for Input<'a>impl<'a> PartialEq<Input<'a>> for Input<'a>[src]
impl<'a> PartialEq<Input<'a>> for Input<'a>impl<'a, 'b> PartialEq<&'b [u8]> for Input<'a>[src]
impl<'a, 'b> PartialEq<&'b [u8]> for Input<'a>fn eq(&self, other: &&'b [u8]) -> bool[src]
fn eq(&self, other: &&'b [u8]) -> bool#[must_use]
fn ne(&self, other: &Rhs) -> bool1.0.0[src]
#[must_use]
fn ne(&self, other: &Rhs) -> bool1.0.0
[src]This method tests for !=.
impl<'a> Eq for Input<'a>[src]
impl<'a> Eq for Input<'a>impl<'a> Copy for Input<'a>[src]
impl<'a> Copy for Input<'a>impl<'a> Clone for Input<'a>[src]
impl<'a> Clone for Input<'a>Auto Trait Implementations
Blanket Implementations
impl<T, U> TryFrom for T where
T: From<U>, [src]
impl<T, U> TryFrom for T where
T: From<U>, type Error = !
🔬 This is a nightly-only experimental API. (
try_from)The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>[src]
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>impl<T> From for T[src]
impl<T> From for Timpl<T, U> TryInto for T where
U: TryFrom<T>, [src]
impl<T, U> TryInto for T where
U: TryFrom<T>, type Error = <U as TryFrom<T>>::Error
🔬 This is a nightly-only experimental API. (
try_from)The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>[src]
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>impl<T, U> Into for T where
U: From<T>, [src]
impl<T, U> Into for T where
U: From<T>, impl<T> Borrow for T where
T: ?Sized, [src]
impl<T> Borrow for T where
T: ?Sized, impl<T> BorrowMut for T where
T: ?Sized, [src]
impl<T> BorrowMut for T where
T: ?Sized, fn borrow_mut(&mut self) -> &mut T[src]
fn borrow_mut(&mut self) -> &mut Timpl<T> Any for T where
T: 'static + ?Sized, [src]
impl<T> Any for T where
T: 'static + ?Sized, fn get_type_id(&self) -> TypeId[src]
fn get_type_id(&self) -> TypeId