gix_worktree_stream

Struct Stream

Source
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 Freeze for Stream

§

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 T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

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

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where 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 T
where 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 T
where U: Into<T>,

Source§

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 T
where U: TryFrom<T>,

Source§

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.