pub struct ServerClient { /* private fields */ }Expand description
A HTTP client for making requests to a Frankfurter API.
Implementations§
Source§impl ServerClient
impl ServerClient
pub fn new(frankfurter_api_url: Url) -> Self
Sourcepub fn with_client(self, client: Client) -> Self
pub fn with_client(self, client: Client) -> Self
Consumes an existing ServerClient and returns one with the given reqwest::Client.
Sourcepub async fn is_server_available(&self) -> bool
pub async fn is_server_available(&self) -> bool
Makes a basic request to the root of the API and returns true in the event of a successful response.
Useful for a simple check that the API is up and successfully responding to requests.
Sourcepub async fn convert(&self, req: Request) -> Result<Response, Error>
pub async fn convert(&self, req: Request) -> Result<Response, Error>
Request exchange rates for a specific date (latest by default).
Trait Implementations§
Source§impl Debug for ServerClient
impl Debug for ServerClient
Auto Trait Implementations§
impl Freeze for ServerClient
impl !RefUnwindSafe for ServerClient
impl Send for ServerClient
impl Sync for ServerClient
impl Unpin for ServerClient
impl !UnwindSafe for ServerClient
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more