Struct mithril_client::ClientBuilder
source · pub struct ClientBuilder { /* private fields */ }
Expand description
Builder than can be used to create a Client easily or with custom dependencies.
Implementations§
source§impl ClientBuilder
impl ClientBuilder
sourcepub fn aggregator(
endpoint: &str,
genesis_verification_key: &str,
) -> ClientBuilder
pub fn aggregator( endpoint: &str, genesis_verification_key: &str, ) -> ClientBuilder
Constructs a new ClientBuilder
that fetches data from the aggregator at the given
endpoint and with the given genesis verification key.
sourcepub fn new(genesis_verification_key: &str) -> ClientBuilder
pub fn new(genesis_verification_key: &str) -> ClientBuilder
Constructs a new ClientBuilder
without any dependency set.
Use ClientBuilder::aggregator if you don’t need to set a custom AggregatorClient to request data from the aggregator.
sourcepub fn build(self) -> MithrilResult<Client>
pub fn build(self) -> MithrilResult<Client>
Returns a Client
that uses the dependencies provided to this ClientBuilder
.
The builder will try to create the missing dependencies using default implementations if possible.
sourcepub fn with_aggregator_client(
self,
aggregator_client: Arc<dyn AggregatorClient>,
) -> ClientBuilder
pub fn with_aggregator_client( self, aggregator_client: Arc<dyn AggregatorClient>, ) -> ClientBuilder
Set the AggregatorClient that will be used to request data to the aggregator.
sourcepub fn with_certificate_verifier(
self,
certificate_verifier: Arc<dyn CertificateVerifier>,
) -> ClientBuilder
pub fn with_certificate_verifier( self, certificate_verifier: Arc<dyn CertificateVerifier>, ) -> ClientBuilder
Set the CertificateVerifier that will be used to validate certificates.
sourcepub fn with_snapshot_downloader(
self,
snapshot_downloader: Arc<dyn SnapshotDownloader>,
) -> ClientBuilder
pub fn with_snapshot_downloader( self, snapshot_downloader: Arc<dyn SnapshotDownloader>, ) -> ClientBuilder
Set the SnapshotDownloader that will be used to download snapshots.
sourcepub fn with_logger(self, logger: Logger) -> Self
pub fn with_logger(self, logger: Logger) -> Self
Set the [Logger] to use.
sourcepub fn add_feedback_receiver(self, receiver: Arc<dyn FeedbackReceiver>) -> Self
pub fn add_feedback_receiver(self, receiver: Arc<dyn FeedbackReceiver>) -> Self
Add a feedback receiver to receive events for tasks that can have a long duration (ie: snapshot download or a long certificate chain validation).
sourcepub fn with_options(self, options: ClientOptions) -> Self
pub fn with_options(self, options: ClientOptions) -> Self
Sets the options to be used by the client.
Auto Trait Implementations§
impl Freeze for ClientBuilder
impl !RefUnwindSafe for ClientBuilder
impl Send for ClientBuilder
impl Sync for ClientBuilder
impl Unpin for ClientBuilder
impl !UnwindSafe for ClientBuilder
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
source§impl<T> CheckedAs for T
impl<T> CheckedAs for T
source§fn checked_as<Dst>(self) -> Option<Dst>where
T: CheckedCast<Dst>,
fn checked_as<Dst>(self) -> Option<Dst>where
T: CheckedCast<Dst>,
source§impl<Src, Dst> CheckedCastFrom<Src> for Dstwhere
Src: CheckedCast<Dst>,
impl<Src, Dst> CheckedCastFrom<Src> for Dstwhere
Src: CheckedCast<Dst>,
source§fn checked_cast_from(src: Src) -> Option<Dst>
fn checked_cast_from(src: Src) -> Option<Dst>
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§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>
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>
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