style: format code
formats code according to `cargo fmt` standards
This commit is contained in:
parent
f3f3478ae0
commit
be326f52ca
2 changed files with 67 additions and 54 deletions
33
src/lib.rs
33
src/lib.rs
|
@ -1,48 +1,51 @@
|
|||
//! This library provides access to the Bunny API asynchronously using tokio, it's not fully implemented but PRs are welcome.
|
||||
//!
|
||||
//!
|
||||
//! # Getting started
|
||||
//! 1. add package to your project using cargo
|
||||
//!
|
||||
//!
|
||||
//! `$ cargo add bunny-api-tokio`
|
||||
//!
|
||||
//!
|
||||
//! 2. Start coding
|
||||
//!
|
||||
//!
|
||||
//! ```
|
||||
//! use bunny_api_tokio::{Client, error::Error};
|
||||
//!
|
||||
//!
|
||||
//! #[tokio::main]
|
||||
//! async fn main() -> Result<(), Error> {
|
||||
//! let mut client = Client::new("api_key").await?;
|
||||
//!
|
||||
//!
|
||||
//! Ok(())
|
||||
//! }
|
||||
//! ```
|
||||
#![deny(missing_docs)]
|
||||
|
||||
use std::sync::Arc;
|
||||
use reqwest::{header::{HeaderMap, HeaderValue}, Client as RClient};
|
||||
use error::Error;
|
||||
use reqwest::{
|
||||
Client as RClient,
|
||||
header::{HeaderMap, HeaderValue},
|
||||
};
|
||||
use std::sync::Arc;
|
||||
use url::Url;
|
||||
|
||||
pub mod error;
|
||||
pub mod edge_storage;
|
||||
pub mod error;
|
||||
|
||||
/// API Client for bunny
|
||||
pub struct Client {
|
||||
/// Used to interact with the Edge Storage API
|
||||
pub storage: edge_storage::Storage
|
||||
pub storage: edge_storage::Storage,
|
||||
}
|
||||
|
||||
impl Client {
|
||||
/// Creates a new Client using the supplied `api_key`
|
||||
///
|
||||
///
|
||||
/// ```
|
||||
/// use bunny_api_tokio::{Client, error::Error};
|
||||
///
|
||||
///
|
||||
/// #[tokio::main]
|
||||
/// async fn main() -> Result<(), Error> {
|
||||
/// let mut client = Client::new("api_key").await?;
|
||||
///
|
||||
///
|
||||
/// Ok(())
|
||||
/// }
|
||||
/// ```
|
||||
|
@ -50,9 +53,7 @@ impl Client {
|
|||
let mut headers = HeaderMap::new();
|
||||
headers.append("AccessKey", HeaderValue::from_str(api_key.as_ref())?);
|
||||
|
||||
let reqwest = Arc::new(RClient::builder()
|
||||
.default_headers(headers)
|
||||
.build()?);
|
||||
let reqwest = Arc::new(RClient::builder().default_headers(headers).build()?);
|
||||
|
||||
Ok(Self {
|
||||
storage: edge_storage::Storage {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue