pub struct ByteStream { /* private fields */ }Expand description
An upload body with explicit length, integrity, and replay semantics.
Byte and file bodies are replayable. A caller-provided stream is one-shot and requires both its exact content length and SHA-256 digest so the client never buffers it or silently switches to unsigned payloads.
Implementations§
Source§impl ByteStream
impl ByteStream
Sourcepub fn from_bytes(bytes: impl Into<Bytes>) -> Self
pub fn from_bytes(bytes: impl Into<Bytes>) -> Self
Creates a replayable in-memory body.
Sourcepub fn from_path(path: impl AsRef<Path>) -> Self
pub fn from_path(path: impl AsRef<Path>) -> Self
Creates a replayable file body.
The explicitly supplied file is copied into a private disk-backed snapshot while it is hashed. Every retry reads that immutable snapshot, so changes to the original path cannot alter the signed upload bytes.
Sourcepub fn from_stream<S>(stream: S, length: u64, sha256: [u8; 32]) -> Self
pub fn from_stream<S>(stream: S, length: u64, sha256: [u8; 32]) -> Self
Creates a one-shot stream with a caller-supplied exact digest.
The stream is never retried. sha256 is the digest of exactly length
bytes and is used for SigV4 payload signing.
Trait Implementations§
Source§impl Debug for ByteStream
impl Debug for ByteStream
Source§impl From<&'static [u8]> for ByteStream
impl From<&'static [u8]> for ByteStream
Source§impl From<Bytes> for ByteStream
impl From<Bytes> for ByteStream
Auto Trait Implementations§
impl !Freeze for ByteStream
impl !RefUnwindSafe for ByteStream
impl !Sync for ByteStream
impl !UnwindSafe for ByteStream
impl Send for ByteStream
impl Unpin for ByteStream
impl UnsafeUnpin for ByteStream
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
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 moreCreates a shared type from an unshared type.