pub struct Client { /* private fields */ }Expand description
A client for Objectstore. Use Client::builder to configure and construct a Client.
To perform CRUD operations, one has to create a Client, and then scope it to a Usecase
and Scope in order to create a Session.
§Example
use std::time::Duration;
use objectstore_client::{Client, Usecase};
let client = Client::builder("http://localhost:8888/")
.timeout(Duration::from_secs(1))
.propagate_traces(true)
.build()?;
let usecase = Usecase::new("my_app");
let session = client.session(usecase.for_project(12345, 1337))?;
let response = session.put("hello world").send().await?;
Implementations§
Source§impl Client
impl Client
Sourcepub fn new(service_url: impl IntoUrl) -> Result<Client>
pub fn new(service_url: impl IntoUrl) -> Result<Client>
Creates a new Client, configured with the given service_url and default
configuration.
Use Client::builder for more fine-grained configuration.
§Errors
This method fails if ClientBuilder::build fails.
Sourcepub fn builder(service_url: impl IntoUrl) -> ClientBuilder
pub fn builder(service_url: impl IntoUrl) -> ClientBuilder
Convenience function to create a ClientBuilder.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Client
impl !RefUnwindSafe for Client
impl Send for Client
impl Sync for Client
impl Unpin for Client
impl !UnwindSafe for Client
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