pub struct Payload<T> { /* private fields */ }Expand description
The payload for object uploads via the Storage client.
The storage client functions to upload new objects consume any type that can be converted to this type. That includes simple buffers, and any type implementing StreamingSource.
§Example
use google_cloud_storage::upload_source::StreamingSource;
let buffer : &[u8] = b"the quick brown fox jumps over the lazy dog";
let mut size = 0_usize;
let mut payload = Payload::from(bytes::Bytes::from_static(buffer));
while let Some(bytes) = payload.next().await.transpose()? {
size += bytes.len();
}
assert_eq!(size, buffer.len());Implementations§
Source§impl<T> Payload<T>where
T: StreamingSource,
impl<T> Payload<T>where
T: StreamingSource,
pub fn from_stream(payload: T) -> Self
Trait Implementations§
Source§impl<S> From<S> for Payload<S>where
S: StreamingSource,
impl<S> From<S> for Payload<S>where
S: StreamingSource,
Source§impl<T> StreamingSource for Payload<T>
impl<T> StreamingSource for Payload<T>
Auto Trait Implementations§
impl<T> Freeze for Payload<T>where
T: Freeze,
impl<T> RefUnwindSafe for Payload<T>where
T: RefUnwindSafe,
impl<T> Send for Payload<T>where
T: Send,
impl<T> Sync for Payload<T>where
T: Sync,
impl<T> Unpin for Payload<T>where
T: Unpin,
impl<T> UnwindSafe for Payload<T>where
T: UnwindSafe,
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> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
Wrap the input message
T in a tonic::Request