[][src]Struct artichoke_backend::extn::stdlib::securerandom::hex::Hex

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

An iterator over a byte slice that returns the data as a sequence of hex encoded chars.

Examples

let data = "Artichoke Ruby";
let iter = Hex::from(data);
assert_eq!(iter.collect::<String>(), "4172746963686f6b652052756279");

Implementations

impl<'a> Hex<'a>[src]

#[must_use]pub fn len(&self) -> usize[src]

Returns the number of remaining hex encoded characters in the iterator.

Examples

let iter = Hex::from("");
assert_eq!(iter.len(), 0);

let mut iter = Hex::from("a");
assert_eq!(iter.len(), 2);
assert_eq!(iter.next(), Some('6'));
assert_eq!(iter.len(), 1);
assert_eq!(iter.next(), Some('1'));
assert_eq!(iter.len(), 0);
assert_eq!(iter.next(), None);
assert_eq!(iter.len(), 0);

#[must_use]pub fn is_empty(&self) -> bool[src]

Returns whether the iterator has no more remaining escape codes.

Examples

let iter = Hex::from("");
assert!(iter.is_empty());

let mut iter = Hex::from("a");
assert!(!iter.is_empty());
assert_eq!(iter.next(), Some('6'));
assert!(!iter.is_empty());
assert_eq!(iter.next(), Some('1'));
assert!(iter.is_empty());
assert_eq!(iter.next(), None);
assert!(iter.is_empty());

Trait Implementations

impl<'a> Clone for Hex<'a>[src]

impl<'a> Debug for Hex<'a>[src]

impl<'a> ExactSizeIterator for Hex<'a>[src]

impl<'a> From<&'a [u8]> for Hex<'a>[src]

impl<'a> From<&'a str> for Hex<'a>[src]

impl<'a> FusedIterator for Hex<'a>[src]

impl<'a> Iterator for Hex<'a>[src]

type Item = char

The type of the elements being iterated over.

Auto Trait Implementations

impl<'a> RefUnwindSafe for Hex<'a>[src]

impl<'a> Send for Hex<'a>[src]

impl<'a> Sync for Hex<'a>[src]

impl<'a> Unpin for Hex<'a>[src]

impl<'a> UnwindSafe for Hex<'a>[src]

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<I> IntoIterator for I where
    I: Iterator
[src]

type Item = <I as Iterator>::Item

The type of the elements being iterated over.

type IntoIter = I

Which kind of iterator are we turning this into?

impl<I> IteratorRandom for I where
    I: Iterator
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.

impl<V, T> VZip<V> for T where
    V: MultiLane<T>, 
[src]