pub struct BytesNarSource { /* private fields */ }Expand description
A NarSource over bytes already in memory.
Zero-copy: Bytes slices share one allocation, so re-opening does not
duplicate the NAR. It is still O(nar) resident by construction — that is
the point of the name. Use it for test doubles, for small values, and at a
boundary that genuinely already holds the bytes; never as the way a large
upload reaches a backend.
Implementations§
Source§impl BytesNarSource
impl BytesNarSource
Sourcepub fn new(bytes: impl Into<Bytes>) -> BytesNarSource
pub fn new(bytes: impl Into<Bytes>) -> BytesNarSource
Wrap owned bytes.
Trait Implementations§
Source§impl Clone for BytesNarSource
impl Clone for BytesNarSource
Source§fn clone(&self) -> BytesNarSource
fn clone(&self) -> BytesNarSource
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 BytesNarSource
impl Debug for BytesNarSource
Source§impl From<&[u8]> for BytesNarSource
impl From<&[u8]> for BytesNarSource
Source§fn from(v: &[u8]) -> BytesNarSource
fn from(v: &[u8]) -> BytesNarSource
Converts to this type from the input type.
Source§impl NarSource for BytesNarSource
impl NarSource for BytesNarSource
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,
BytesNarSource: '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,
BytesNarSource: 'async_trait,
Open a fresh chunk stream over the same bytes. Read more
Auto Trait Implementations§
impl !Freeze for BytesNarSource
impl RefUnwindSafe for BytesNarSource
impl Send for BytesNarSource
impl Sync for BytesNarSource
impl Unpin for BytesNarSource
impl UnsafeUnpin for BytesNarSource
impl UnwindSafe for BytesNarSource
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