pub struct ObjectStream<'a> { /* private fields */ }Expand description
Metadata and the single body response it describes. A consumer must read through EOF before treating a complete object as received. Dropping this value cancels the response and establishes no completion verdict.
Implementations§
Source§impl<'a> ObjectStream<'a>
impl<'a> ObjectStream<'a>
Sourcepub fn metadata(&self) -> &StoredObject
pub fn metadata(&self) -> &StoredObject
Observation for the complete object, including on a ranged response.
Sourcepub fn new(
metadata: StoredObject,
range: Option<ByteRange>,
body: impl ObjectBody + 'a,
) -> Result<Self, StorageError>
pub fn new( metadata: StoredObject, range: Option<ByteRange>, body: impl ObjectBody + 'a, ) -> Result<Self, StorageError>
Wrap a native response, bounding its exact body length by the observation.
Sourcepub async fn read(&mut self, output: &mut [u8]) -> Result<usize, StorageError>
pub async fn read(&mut self, output: &mut [u8]) -> Result<usize, StorageError>
Receive bounded bytes and check transport completion and exact framing.
Sourcepub async fn collect(self, maximum: u64) -> Result<ObjectRead, StorageError>
pub async fn collect(self, maximum: u64) -> Result<ObjectRead, StorageError>
Collect only a caller-bounded response. Objects with streamed plaintext
use read instead; the bound is checked before allocating their body.
Auto Trait Implementations§
impl<'a> Freeze for ObjectStream<'a>
impl<'a> !RefUnwindSafe for ObjectStream<'a>
impl<'a> Send for ObjectStream<'a>
impl<'a> !Sync for ObjectStream<'a>
impl<'a> Unpin for ObjectStream<'a>
impl<'a> UnsafeUnpin for ObjectStream<'a>
impl<'a> !UnwindSafe for ObjectStream<'a>
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<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§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 moreCreates a shared type from an unshared type.