[−][src]Struct modio::download::Downloader
A Downloader
can be used to stream a mod file or save the file to a local file.
Constructed with Modio::download
.
Implementations
impl Downloader
[src]
pub async fn save_to_file<P: AsRef<Path>>(self, file: P) -> Result<()>
[src]
Save the mod file to a local file.
Example
let action = modio::DownloadAction::Primary { game_id: 5, mod_id: 19, }; modio.download(action).save_to_file("mod.zip").await?;
pub async fn bytes(self) -> Result<Bytes>
[src]
Get the full mod file as Bytes
.
Example
let action = modio::DownloadAction::Primary { game_id: 5, mod_id: 19, }; let bytes = modio.download(action).bytes().await?;
pub fn stream(self) -> impl Stream<Item = Result<Bytes>>
[src]
Stream
of bytes of the mod file.
Example
use futures_util::TryStreamExt; let action = modio::DownloadAction::Primary { game_id: 5, mod_id: 19, }; let mut st = Box::pin(modio.download(action).stream()); while let Some(bytes) = st.try_next().await? { println!("Bytes: {:?}", bytes); }
Auto Trait Implementations
impl !RefUnwindSafe for Downloader
[src]
impl Send for Downloader
[src]
impl Sync for Downloader
[src]
impl Unpin for Downloader
[src]
impl !UnwindSafe for Downloader
[src]
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T> Instrument for T
[src]
pub fn instrument(self, span: Span) -> Instrumented<Self>
[src]
pub fn in_current_span(self) -> Instrumented<Self>
[src]
impl<T> Instrument for T
[src]
pub fn instrument(self, span: Span) -> Instrumented<Self>
[src]
pub fn in_current_span(self) -> Instrumented<Self>
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,