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
impl Stream
Lifecycle
Sourcepub fn into_read(self) -> impl Read
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.
Sourcepub fn as_read_mut(&mut self) -> &mut impl Read
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.
Sourcepub fn from_read(read: impl Read + 'static) -> Self
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
impl Stream
Entries
Sourcepub fn add_entry(&mut self, entry: AdditionalEntry) -> &mut Self
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()
.
Sourcepub fn add_entry_from_path(
&mut self,
root: &Path,
path: &Path,
) -> Result<&mut Self>
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.