Struct Bytes

#[must_use = "iterators are lazy and do nothing unless consumed"]
pub struct Bytes<'a> { pub(in ::ffi::c_str) ptr: NonNull<u8>, pub(in ::ffi::c_str) phantom: PhantomData<&'a [c_char]> }

An iterator over the bytes of a CStr, without the nul terminator.

This struct is created by the bytes method on CStr. See its documentation for more.

Fields

ptr: NonNull<u8>
phantom: PhantomData<&'a [c_char]>

Implementations

impl<'a> Bytes<'a>

fn new(s: &'a CStr) -> Self
fn is_empty(&self) -> bool

Trait Implementations

impl FusedIterator for Bytes<'_>

impl Iterator for Bytes<'_>

type Item = u8;
fn next(&mut self) -> Option<u8>
fn size_hint(&self) -> (usize, Option<usize>)
fn count(self) -> usize

impl Send for Bytes<'_>

impl Sync for Bytes<'_>

impl<'a> Clone for Bytes<'a>

fn clone(&self) -> Self

impl<'a> Debug for Bytes<'a>

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Auto Trait Implementations

impl<'a> Freeze for Bytes<'a>

impl<'a> RefUnwindSafe for Bytes<'a>

impl<'a> Unpin for Bytes<'a>

impl<'a> UnsafeUnpin for Bytes<'a>

impl<'a> UnwindSafe for Bytes<'a>

Blanket Implementations

impl<I> IntoIterator for Bytes<'a> where I: Iterator,

type Item = <I as Iterator>::Item;
type IntoIter = I;
fn into_iter(self) -> I

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

fn type_id(&self) -> TypeId

impl<T> Borrow<T> for Bytes<'a> where T: ?Sized,

fn borrow(&self) -> &T

impl<T> BorrowMut<T> for Bytes<'a> where T: ?Sized,

fn borrow_mut(&mut self) -> &mut T

impl<T> CloneToUninit for Bytes<'a> where T: Clone,

unsafe fn clone_to_uninit(&self, dest: *mut u8)

impl<T> From<T> for Bytes<'a>

fn from(t: T) -> T

Returns the argument unchanged.

impl<T> SizeHint for Bytes<'a> where T: ?Sized,

fn lower_bound(&self) -> usize
fn upper_bound(&self) -> Option<usize>

impl<T> SizedTypeProperties for Bytes<'a>

impl<T, U> Into<U> for Bytes<'a> where U: From<T>,

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of [From]<T> for U chooses to do.

impl<T, U> TryFrom<U> for Bytes<'a> where U: Into<T>,

type Error = never;
fn try_from(value: U) -> Result<T, never>

impl<T, U> TryInto<U> for Bytes<'a> where U: TryFrom<T>,

type Error = <U as TryFrom<T>>::Error;
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>