Struct git2::string_array::StringArray[][src]

pub struct StringArray { /* fields omitted */ }
Expand description

A string array structure used by libgit2

Some apis return arrays of strings which originate from libgit2. This wrapper type behaves a little like Vec<&str> but does so without copying the underlying strings until necessary.

Implementations

impl StringArray[src]

pub fn get(&self, i: usize) -> Option<&str>[src]

Returns None if the i’th string is not utf8 or if i is out of bounds.

pub fn get_bytes(&self, i: usize) -> Option<&[u8]>[src]

Returns None if i is out of bounds.

pub fn iter(&self) -> Iter<'_>

Notable traits for Iter<'a>

impl<'a> Iterator for Iter<'a> type Item = Option<&'a str>;
[src]

Returns an iterator over the strings contained within this array.

The iterator yields Option<&str> as it is unknown whether the contents are utf-8 or not.

pub fn iter_bytes(&self) -> IterBytes<'_>

Notable traits for IterBytes<'a>

impl<'a> Iterator for IterBytes<'a> type Item = &'a [u8];
[src]

Returns an iterator over the strings contained within this array, yielding byte slices.

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

Returns the number of strings in this array.

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

Return true if this array is empty.

Trait Implementations

impl Drop for StringArray[src]

fn drop(&mut self)[src]

Executes the destructor for this type. Read more

impl<'a> IntoIterator for &'a StringArray[src]

type Item = Option<&'a str>

The type of the elements being iterated over.

type IntoIter = Iter<'a>

Which kind of iterator are we turning this into?

fn into_iter(self) -> Self::IntoIter[src]

Creates an iterator from a value. Read more

Auto Trait Implementations

Blanket Implementations

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

pub fn type_id(&self) -> TypeId[src]

Gets the TypeId of self. Read more

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

pub fn borrow(&self) -> &T[src]

Immutably borrows from an owned value. Read more

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

pub fn borrow_mut(&mut self) -> &mut T[src]

Mutably borrows from an owned value. Read more

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

pub fn from(t: T) -> T[src]

Performs the conversion.

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

pub fn into(self) -> U[src]

Performs the conversion.

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.

pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>[src]

Performs the conversion.

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.

pub fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>[src]

Performs the conversion.