Struct spinoso_string::Center[][src]

pub struct Center<'a, 'b> { /* fields omitted */ }

An iterator that yields a byte string centered within a padding byte string.

This struct is created by the center method on a Spinoso String. See its documentation for more.


use spinoso_string::String;

let s = String::from("hello");

assert_eq!(, None).collect::<Vec<_>>(), b"hello");
assert_eq!(, None).collect::<Vec<_>>(), b"       hello        ");
assert_eq!(, Some(&b"123"[..])).collect::<Vec<_>>(), b"1231231hello12312312");

This iterator is encoding-aware. Conventionally UTF-8 strings are iterated by UTF-8 byte sequences.

use spinoso_string::String;

let s = String::from("💎");

assert_eq!(, None).collect::<Vec<_>>(), " 💎 ".as_bytes());

Trait Implementations

impl<'a, 'b> Clone for Center<'a, 'b>[src]

impl<'a, 'b> Debug for Center<'a, 'b>[src]

impl<'a, 'b> Default for Center<'a, 'b>[src]

impl<'a, 'b> ExactSizeIterator for Center<'a, 'b>[src]

impl<'a, 'b> FusedIterator for Center<'a, 'b>[src]

impl<'a, 'b> Iterator for Center<'a, 'b>[src]

type Item = u8

The type of the elements being iterated over.

Auto Trait Implementations

impl<'a, 'b> RefUnwindSafe for Center<'a, 'b>

impl<'a, 'b> Send for Center<'a, 'b>

impl<'a, 'b> Sync for Center<'a, 'b>

impl<'a, 'b> Unpin for Center<'a, 'b>

impl<'a, 'b> UnwindSafe for Center<'a, 'b>

Blanket Implementations

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

impl<T> Borrow<T> for T where
    T: ?Sized

impl<T> BorrowMut<T> for T where
    T: ?Sized

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

impl<T, U> Into<U> for T where
    U: From<T>, 

impl<I> IntoIterator for I where
    I: Iterator

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<T> ToOwned for T where
    T: Clone

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 

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

The type returned in the event of a conversion error.