pub struct Stream { /* private fields */ }
Expand description

A stream of entries that originate from a git tree and optionally from additional entries.

Note that a git tree is mandatory, but the empty tree can be used to effectively disable it.

Implementations§

source§

impl Stream

source

pub fn next_entry(&mut self) -> Result<Option<Entry<'_>>, Error>

Access the next entry of the stream or None if there is nothing more to read.

source§

impl Stream

Lifecycle

source

pub fn into_read(self) -> impl Read

Turn ourselves into the underlying byte stream which is a representation of the underlying git tree.

Note that the format is unspecified, and its sole use is for transport, not for persistence. Can be used with Self::from_read() to decode the contained entries.

source

pub fn as_read_mut(&mut self) -> &mut impl Read

Return our internal byte stream from which entries would be generated.

Note that the stream must then be consumed in its entirety.

source

pub fn from_read(read: impl Read + 'static) -> Self

Create a new instance from a stream of bytes in our format.

It must have been created from Self::into_read() to be compatible, and must not have been persisted.

source§

impl Stream

Entries

source

pub fn add_entry(&mut self, entry: AdditionalEntry) -> &mut Self

Add entry to the list of entries to be returned in calls to Self::next_entry().

The entry will be returned after the one contained in the tree, in order of addition.

Panics

If called after the first call to Self::next_entry().

source

pub fn add_entry_from_path( &mut self, root: &Path, path: &Path ) -> Result<&mut Self>

Add the item at path as entry to this stream, which is expected to be under root.

Note that the created entries will always have a null SHA1, and that we access this path to determine its type, and will access it again when it is requested.

Auto Trait Implementations§

§

impl !RefUnwindSafe for Stream

§

impl !Send for Stream

§

impl !Sync for Stream

§

impl Unpin for Stream

§

impl !UnwindSafe for Stream

Blanket Implementations§

source§

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

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

source§

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

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

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

source§

fn into(self) -> U

Calls U::from(self).

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

source§

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

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

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

Performs the conversion.
source§

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

§

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

The type returned in the event of a conversion error.
source§

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

Performs the conversion.