pub struct B2FileStream { /* private fields */ }Expand description
A file stream for the B2File, you’re most likely gonna only use it as the following:
let mut response = client
.download_file_by_id(B2DownloadFileByIdQueryParameters::builder().file_id("...".into()).build())
.await
.unwrap();
let data = response.file.read_all().await;Implementations§
Source§impl B2FileStream
impl B2FileStream
pub fn new<S>(stream: S, size: usize) -> Self
Sourcepub async fn read_all(self) -> Result<Bytes, B2Error>
pub async fn read_all(self) -> Result<Bytes, B2Error>
Reads the entire file at once, consuming self in the process.
Sourcepub fn into_stream(
self,
) -> (usize, Pin<Box<dyn Stream<Item = Result<Bytes, Error>> + Send>>)
pub fn into_stream( self, ) -> (usize, Pin<Box<dyn Stream<Item = Result<Bytes, Error>> + Send>>)
Consumes self, then returns the underlying stream and file size
Sourcepub fn add_middleware(&mut self, middleware: B2Callback<Bytes>) -> &mut Self
pub fn add_middleware(&mut self, middleware: B2Callback<Bytes>) -> &mut Self
Adds a middleware to the list to run, returns mutable reference to self.
Auto Trait Implementations§
impl Freeze for B2FileStream
impl !RefUnwindSafe for B2FileStream
impl Send for B2FileStream
impl !Sync for B2FileStream
impl Unpin for B2FileStream
impl !UnwindSafe for B2FileStream
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