pub struct TransferBuilder<'a, E> { /* private fields */ }Expand description
Builds a streaming transfer. Obtained from Cx::upload / Cx::download;
finished with start, which subscribes and returns the key.
Implementations§
Source§impl<'a, E> TransferBuilder<'a, E>
impl<'a, E> TransferBuilder<'a, E>
Sourcepub fn method(self, m: impl Into<String>) -> Self
pub fn method(self, m: impl Into<String>) -> Self
Override the upload method (default PUT). No effect on download.
Sourcepub fn header(self, name: impl Into<String>, value: impl Into<String>) -> Self
pub fn header(self, name: impl Into<String>, value: impl Into<String>) -> Self
Add a request header (order preserved, repeats allowed).
Sourcepub fn bearer(self, token: impl AsRef<str>) -> Self
pub fn bearer(self, token: impl AsRef<str>) -> Self
Sugar for header("Authorization", format!("Bearer {token}")).
Sourcepub fn start(
self,
key: impl Into<String>,
on_event: impl Fn(TransferEvent) -> E + Send + 'static,
) -> String
pub fn start( self, key: impl Into<String>, on_event: impl Fn(TransferEvent) -> E + Send + 'static, ) -> String
Subscribe under key. on_event fires per progress tick and once at Done.
Returns key so the caller can cx.unsubscribe(key).
Auto Trait Implementations§
impl<'a, E> !RefUnwindSafe for TransferBuilder<'a, E>
impl<'a, E> !Sync for TransferBuilder<'a, E>
impl<'a, E> !UnwindSafe for TransferBuilder<'a, E>
impl<'a, E> Freeze for TransferBuilder<'a, E>
impl<'a, E> Send for TransferBuilder<'a, E>
impl<'a, E> Unpin for TransferBuilder<'a, E>
impl<'a, E> UnsafeUnpin for TransferBuilder<'a, E>
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