[][src]Struct modio::download::Downloader

pub struct Downloader { /* fields omitted */ }

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

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T> Instrument for T[src]

impl<T> Instrument for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.