hf_hub::api::tokio

Trait Progress

Source
pub trait Progress {
    // Required methods
    fn init(
        &mut self,
        size: usize,
        filename: &str,
    ) -> impl Future<Output = ()> + Send;
    fn update(&mut self, size: usize) -> impl Future<Output = ()> + Send;
    fn finish(&mut self) -> impl Future<Output = ()> + Send;
}
Expand description

This trait is used by users of the lib to implement custom behavior during file downloads

Required Methods§

Source

fn init( &mut self, size: usize, filename: &str, ) -> impl Future<Output = ()> + Send

At the start of the download The size is the total size in bytes of the file.

Source

fn update(&mut self, size: usize) -> impl Future<Output = ()> + Send

This function is called whenever size bytes have been downloaded in the temporary file

Source

fn finish(&mut self) -> impl Future<Output = ()> + Send

This is called at the end of the download

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementations on Foreign Types§

Source§

impl Progress for ()

Source§

async fn init(&mut self, _size: usize, _filename: &str)

Source§

async fn finish(&mut self)

Source§

async fn update(&mut self, _size: usize)

Source§

impl Progress for ProgressBar

Source§

async fn init(&mut self, size: usize, filename: &str)

Source§

async fn finish(&mut self)

Source§

async fn update(&mut self, size: usize)

Implementors§