pub struct ClientBuilder {
    pub node_manager_builder: NodeManagerBuilder,
    pub broker_options: BrokerOptions,
    pub network_info: NetworkInfo,
    pub api_timeout: Duration,
    pub remote_pow_timeout: Duration,
    pub pow_worker_count: Option<usize>,
}
Expand description

Builder to construct client instance with sensible default values

Fields§

§node_manager_builder: NodeManagerBuilder

Node manager builder

§broker_options: BrokerOptions
Available on crate feature mqtt only.

Options for the MQTT broker

§network_info: NetworkInfo

Data related to the used network

§api_timeout: Duration

Timeout for API requests

§remote_pow_timeout: Duration

Timeout when sending a block that requires remote proof of work

§pow_worker_count: Option<usize>

The amount of threads to be used for proof of work

Implementations§

source§

impl ClientBuilder

source

pub fn new() -> Self

Creates an IOTA client builder.

source

pub fn from_json(self, client_config: &str) -> Result<Self>

Set the fields from a client JSON config

source

pub fn to_json(&self) -> Result<String>

Export the client builder as JSON string

source

pub fn with_node(self, url: &str) -> Result<Self>

Adds an IOTA node by its URL.

source

pub fn with_primary_node(self, url: &str, auth: Option<NodeAuth>) -> Result<Self>

Adds an IOTA node by its URL to be used as primary node, with optional jwt and or basic authentication

source

pub fn with_primary_pow_node( self, url: &str, auth: Option<NodeAuth> ) -> Result<Self>

Adds an IOTA node by its URL to be used as primary PoW node (for remote Pow), with optional jwt and or basic authentication

source

pub fn with_permanode(self, url: &str, auth: Option<NodeAuth>) -> Result<Self>

Adds a permanode by its URL, with optional jwt and or basic authentication

source

pub fn with_node_auth(self, url: &str, auth: Option<NodeAuth>) -> Result<Self>

Adds an IOTA node by its URL with optional jwt and or basic authentication

source

pub fn with_nodes(self, urls: &[&str]) -> Result<Self>

Adds a list of IOTA nodes by their URLs.

source

pub fn with_node_sync_interval(self, node_sync_interval: Duration) -> Self

Set the node sync interval

source

pub fn with_ignore_node_health(self) -> Self

Ignores the node health status. Every node will be considered healthy and ready to use.

source

pub fn with_quorum(self, quorum: bool) -> Self

Set if quorum should be used or not

source

pub fn with_min_quorum_size(self, min_quorum_size: usize) -> Self

Set amount of nodes which should be used for quorum

source

pub fn with_quorum_threshold(self, threshold: usize) -> Self

Set quorum_threshold

source

pub fn with_mqtt_broker_options(self, options: BrokerOptions) -> Self

Available on crate feature mqtt only.

Sets the MQTT broker options.

source

pub fn with_local_pow(self, local: bool) -> Self

Sets whether the PoW should be done locally or remotely.

source

pub fn with_pow_worker_count(self, worker_count: usize) -> Self

Sets the amount of workers that should be used for PoW, default is num_cpus::get().

source

pub fn with_fallback_to_local_pow(self, fallback_to_local_pow: bool) -> Self

Sets whether the PoW should be done locally in case a node doesn’t support remote PoW.

source

pub fn with_tips_interval(self, tips_interval: u64) -> Self

Sets after how many seconds new tips will be requested during PoW

source

pub fn with_api_timeout(self, timeout: Duration) -> Self

Sets the default request timeout.

source

pub fn with_remote_pow_timeout(self, timeout: Duration) -> Self

Sets the request timeout for API usage.

source

pub fn with_user_agent(self, user_agent: String) -> Self

Set User-Agent header for requests Default is “iota-client/{version}”

source

pub fn finish(self) -> Result<Client>

Build the Client instance.

Trait Implementations§

source§

impl Clone for ClientBuilder

source§

fn clone(&self) -> ClientBuilder

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Debug for ClientBuilder

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl Default for ClientBuilder

source§

fn default() -> Self

Returns the “default value” for a type. Read more
source§

impl<'de> Deserialize<'de> for ClientBuilder

source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
source§

impl PartialEq<ClientBuilder> for ClientBuilder

source§

fn eq(&self, other: &ClientBuilder) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl Serialize for ClientBuilder

source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
source§

impl Eq for ClientBuilder

source§

impl StructuralEq for ClientBuilder

source§

impl StructuralPartialEq for ClientBuilder

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

const: unstable · source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

const: unstable · source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<Q, K> Equivalent<K> for Qwhere Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

source§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
source§

impl<Q, K> Equivalent<K> for Qwhere Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
source§

impl<T> From<T> for T

const: unstable · source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T> Instrument for T

source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
source§

impl<T, U> Into<U> for Twhere U: From<T>,

const: unstable · source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> Same<T> for T

§

type Output = T

Should always be Self
source§

impl<T> ToOwned for Twhere T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
const: unstable · source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
const: unstable · source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<V, T> VZip<V> for Twhere V: MultiLane<T>,

§

fn vzip(self) -> V

source§

impl<T> WithSubscriber for T

source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
source§

impl<T> DeserializeOwned for Twhere T: for<'de> Deserialize<'de>,