Struct auditor::client::AuditorClientBuilder
source · pub struct AuditorClientBuilder { /* private fields */ }
Expand description
The AuditorClientBuilder
is used to build an instance of
either AuditorClient
or AuditorClientBlocking
.
§Examples
Using the address
and port
of the Auditor instance:
let client = AuditorClientBuilder::new()
.address(&"localhost", 8000)
.timeout(20)
.build()?;
Using an connection string:
let client = AuditorClientBuilder::new()
.connection_string(&"http://localhost:8000")
.build()?;
Implementations§
source§impl AuditorClientBuilder
impl AuditorClientBuilder
sourcepub fn new() -> AuditorClientBuilder
pub fn new() -> AuditorClientBuilder
Constructor.
sourcepub fn address<T: AsRef<str>>(self, address: &T, port: u16) -> Self
pub fn address<T: AsRef<str>>(self, address: &T, port: u16) -> Self
Set the address and port of the Auditor server.
§Arguments
address
- Host name / IP address of the Auditor instance.port
- Port of the Auditor instance.
sourcepub fn connection_string<T: AsRef<str>>(self, connection_string: &T) -> Self
pub fn connection_string<T: AsRef<str>>(self, connection_string: &T) -> Self
Set a connection string of the form http://<auditor_address>:<auditor_port>
.
§Arguments
connection_string
- Connection string.
sourcepub fn build(self) -> Result<AuditorClient, ClientError>
pub fn build(self) -> Result<AuditorClient, ClientError>
Build an AuditorClient
from AuditorClientBuilder
.
§Errors
ClientError::InvalidTimeout
- If the timeout duration is less than zero.ClientError::ReqwestError
- If there was an error building the HTTP client.
sourcepub fn build_blocking(self) -> Result<AuditorClientBlocking, ClientError>
pub fn build_blocking(self) -> Result<AuditorClientBlocking, ClientError>
Build an AuditorClientBlocking
from AuditorClientBuilder
.
§Errors
ClientError::InvalidTimeout
- If the timeout duration is less than zero.ClientError::ReqwestError
- If there was an error building the HTTP client.
§Panics
This method panics if it is called from an async runtime.
Trait Implementations§
source§impl Clone for AuditorClientBuilder
impl Clone for AuditorClientBuilder
source§fn clone(&self) -> AuditorClientBuilder
fn clone(&self) -> AuditorClientBuilder
Returns a copy of the value. Read more
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreAuto Trait Implementations§
impl Freeze for AuditorClientBuilder
impl RefUnwindSafe for AuditorClientBuilder
impl Send for AuditorClientBuilder
impl Sync for AuditorClientBuilder
impl Unpin for AuditorClientBuilder
impl UnwindSafe for AuditorClientBuilder
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
source§impl<T> FutureExt for T
impl<T> FutureExt for T
source§fn with_context(self, otel_cx: Context) -> WithContext<Self>
fn with_context(self, otel_cx: Context) -> WithContext<Self>
source§fn with_current_context(self) -> WithContext<Self>
fn with_current_context(self) -> WithContext<Self>
source§impl<T> Instrument for T
impl<T> Instrument for T
source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
source§impl<T> IntoEither for T
impl<T> IntoEither for T
source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moresource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more