Compare commits

...

2 commits

Author SHA1 Message Date
53e5238485 fix: use correct syntax in doctests 2025-05-24 03:34:07 +02:00
6832215aaa build: add dev-dependencies for doctest
Most tests will still fail due to the API key but this will make checking of the code formatting, etc. easier.
2025-05-24 03:34:03 +02:00
4 changed files with 19 additions and 5 deletions

12
Cargo.lock generated
View file

@ -1075,9 +1075,21 @@ dependencies = [
"mio", "mio",
"pin-project-lite", "pin-project-lite",
"socket2", "socket2",
"tokio-macros",
"windows-sys 0.52.0", "windows-sys 0.52.0",
] ]
[[package]]
name = "tokio-macros"
version = "2.5.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6e06d43f1345a3bcd39f6a56dbb7dcab2ba47e68e8ac134855e7e2bdbaf8cab8"
dependencies = [
"proc-macro2",
"quote",
"syn",
]
[[package]] [[package]]
name = "tokio-native-tls" name = "tokio-native-tls"
version = "0.3.1" version = "0.3.1"

View file

@ -14,6 +14,8 @@ keywords = [
"tokio", "tokio",
] ]
[dev-dependencies]
tokio = { version = "1.45.0", features = ["fs", "rt", "rt-multi-thread", "macros"] }
[dependencies] [dependencies]
bytes = "1.10.1" bytes = "1.10.1"

View file

@ -89,7 +89,7 @@ impl Client {
/// // Bunny.net api key /// // Bunny.net api key
/// let mut client = Client::new("api_key").await?; /// let mut client = Client::new("api_key").await?;
/// ///
/// let countries = client.get_countries().await?; /// let countries = client.get_country_list().await?;
/// ///
/// println!("{:#?}", countries); /// println!("{:#?}", countries);
/// Ok(()) /// Ok(())
@ -191,7 +191,7 @@ impl Client {
/// // Bunny.net api key /// // Bunny.net api key
/// let mut client = Client::new("api_key").await?; /// let mut client = Client::new("api_key").await?;
/// ///
/// client.purge_url("https://url_to_purge.com", false).await?; /// client.purge_url("https://url_to_purge.com".parse()?, false).await?;
/// ///
/// Ok(()) /// Ok(())
/// } /// }

View file

@ -144,7 +144,7 @@ impl<'a> Storage {
/// let file_bytes = fs::read("path/to/file.png").await.unwrap(); /// let file_bytes = fs::read("path/to/file.png").await.unwrap();
/// ///
/// // Will put a file in STORAGE_ZONE/images/file.png /// // Will put a file in STORAGE_ZONE/images/file.png
/// client.storage.upload("/images/file.png", file_bytes).await?; /// client.storage.upload("/images/file.png", file_bytes.into()).await?;
/// ///
/// Ok(()) /// Ok(())
/// } /// }
@ -184,7 +184,7 @@ impl<'a> Storage {
/// let contents = client.storage.download("/images/file.png").await?; /// let contents = client.storage.download("/images/file.png").await?;
/// ///
/// let mut file = fs::File::create("file.png").await.unwrap(); /// let mut file = fs::File::create("file.png").await.unwrap();
/// file.write_all(contents).await.unwrap(); /// file.write_all(&contents).await.unwrap();
/// ///
/// Ok(()) /// Ok(())
/// } /// }
@ -253,7 +253,7 @@ impl<'a> Storage {
/// // Will list the files in STORAGE_ZONE/images/ /// // Will list the files in STORAGE_ZONE/images/
/// let files = client.storage.list("/images/").await?; /// let files = client.storage.list("/images/").await?;
/// ///
/// println!("{:#?}", files) /// println!("{:#?}", files);
/// ///
/// Ok(()) /// Ok(())
/// } /// }