pub struct FileNarSource { /* private fields */ }Expand description
A NarSource over a file on disk.
Each open is a fresh File read in NAR_CHUNK_BYTES
steps — O(chunk) resident regardless of file size. This is what a spooled
HTTP upload and a local-tier promotion both ride on.
Implementations§
Source§impl FileNarSource
impl FileNarSource
Sourcepub fn new(path: impl Into<PathBuf>) -> FileNarSource
pub fn new(path: impl Into<PathBuf>) -> FileNarSource
Source the file at path. The length is probed lazily on first
size_hint caller demand — construction does no
I/O, so a missing file surfaces at open where it can be reported.
Trait Implementations§
Source§impl Clone for FileNarSource
impl Clone for FileNarSource
Source§fn clone(&self) -> FileNarSource
fn clone(&self) -> FileNarSource
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for FileNarSource
impl Debug for FileNarSource
Source§impl NarSource for FileNarSource
impl NarSource for FileNarSource
Source§fn size_hint(&self) -> Option<u64>
fn size_hint(&self) -> Option<u64>
Total byte length if it is known before reading. Backends use it to size
a multipart upload or to reject an over-cap value before reading a
single byte;
None is always legal and must never be load-bearing.Source§fn open<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<Pin<Box<dyn Stream<Item = Result<Bytes, StoreError>> + Send>>, StoreError>> + Send + 'async_trait>>where
'life0: 'async_trait,
FileNarSource: 'async_trait,
fn open<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<Pin<Box<dyn Stream<Item = Result<Bytes, StoreError>> + Send>>, StoreError>> + Send + 'async_trait>>where
'life0: 'async_trait,
FileNarSource: 'async_trait,
Open a fresh chunk stream over the same bytes. Read more
Auto Trait Implementations§
impl Freeze for FileNarSource
impl RefUnwindSafe for FileNarSource
impl Send for FileNarSource
impl Sync for FileNarSource
impl Unpin for FileNarSource
impl UnsafeUnpin for FileNarSource
impl UnwindSafe for FileNarSource
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more