Struct untrusted::Input [−][src]
A wrapper around &'a [u8]
that helps in writing panic-free code.
No methods of Input
will ever panic.
Implementations
impl<'a> Input<'a>
[src][−]
pub const fn from(bytes: &'a [u8]) -> Self
[src][−]
Construct a new Input
for the given input bytes
.
pub fn is_empty(&self) -> bool
[src][−]
Returns true
if the input is empty and false otherwise.
pub fn len(&self) -> usize
[src][−]
Returns 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][−]
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 as_slice_less_safe(&self) -> &'a [u8]
[src][−]
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][+]
impl<'a> Copy for Input<'a>
[src]
impl<'a> Debug for Input<'a>
[src][+]
impl<'a> Eq for Input<'a>
[src]
impl<'a> From<&'a [u8]> for Input<'a>
[src][+]
impl PartialEq<[u8]> for Input<'_>
[src][+]
impl PartialEq<Input<'_>> for Input<'_>
[src][+]
impl PartialEq<Input<'_>> for [u8]
[src][+]
impl<'a> StructuralEq for Input<'a>
[src]
Auto Trait Implementations
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,
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>,
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src][+]
U: TryFrom<T>,