Struct iota_client::client::ClientBuilder
source · pub struct ClientBuilder {
pub node_manager_builder: NodeManagerBuilder,
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
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
sourceimpl ClientBuilder
impl ClientBuilder
sourcepub fn from_json(self, client_config: &str) -> Result<Self>
pub fn from_json(self, client_config: &str) -> Result<Self>
Set the fields from a client JSON config
sourcepub fn with_primary_node(self, url: &str, auth: Option<NodeAuth>) -> Result<Self>
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
sourcepub fn with_primary_pow_node(
self,
url: &str,
auth: Option<NodeAuth>
) -> Result<Self>
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
sourcepub fn with_permanode(self, url: &str, auth: Option<NodeAuth>) -> Result<Self>
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
sourcepub fn with_node_auth(self, url: &str, auth: Option<NodeAuth>) -> Result<Self>
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
sourcepub fn with_nodes(self, urls: &[&str]) -> Result<Self>
pub fn with_nodes(self, urls: &[&str]) -> Result<Self>
Adds a list of IOTA nodes by their URLs.
sourcepub fn with_node_sync_interval(self, node_sync_interval: Duration) -> Self
pub fn with_node_sync_interval(self, node_sync_interval: Duration) -> Self
Set the node sync interval
sourcepub fn with_ignore_node_health(self) -> Self
pub fn with_ignore_node_health(self) -> Self
Ignores the node health status. Every node will be considered healthy and ready to use.
sourcepub fn with_quorum(self, quorum: bool) -> Self
pub fn with_quorum(self, quorum: bool) -> Self
Set if quorum should be used or not
sourcepub fn with_min_quorum_size(self, min_quorum_size: usize) -> Self
pub fn with_min_quorum_size(self, min_quorum_size: usize) -> Self
Set amount of nodes which should be used for quorum
sourcepub fn with_quorum_threshold(self, threshold: usize) -> Self
pub fn with_quorum_threshold(self, threshold: usize) -> Self
Set quorum_threshold
sourcepub fn with_local_pow(self, local: bool) -> Self
pub fn with_local_pow(self, local: bool) -> Self
Sets whether the PoW should be done locally or remotely.
sourcepub fn with_pow_worker_count(self, worker_count: usize) -> Self
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().
sourcepub fn with_fallback_to_local_pow(self, fallback_to_local_pow: bool) -> Self
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.
sourcepub fn with_tips_interval(self, tips_interval: u64) -> Self
pub fn with_tips_interval(self, tips_interval: u64) -> Self
Sets after how many seconds new tips will be requested during PoW
sourcepub fn with_api_timeout(self, timeout: Duration) -> Self
pub fn with_api_timeout(self, timeout: Duration) -> Self
Sets the default request timeout.
sourcepub fn with_remote_pow_timeout(self, timeout: Duration) -> Self
pub fn with_remote_pow_timeout(self, timeout: Duration) -> Self
Sets the request timeout for API usage.
sourcepub fn with_user_agent(self, user_agent: String) -> Self
pub fn with_user_agent(self, user_agent: String) -> Self
Set User-Agent header for requests Default is “iota-client/{version}”
Trait Implementations
sourceimpl Clone for ClientBuilder
impl Clone for ClientBuilder
sourcefn clone(&self) -> ClientBuilder
fn clone(&self) -> ClientBuilder
1.0.0 · sourcefn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moresourceimpl Debug for ClientBuilder
impl Debug for ClientBuilder
sourceimpl Default for ClientBuilder
impl Default for ClientBuilder
sourceimpl<'de> Deserialize<'de> for ClientBuilder
impl<'de> Deserialize<'de> for ClientBuilder
sourcefn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
sourceimpl PartialEq<ClientBuilder> for ClientBuilder
impl PartialEq<ClientBuilder> for ClientBuilder
sourcefn eq(&self, other: &ClientBuilder) -> bool
fn eq(&self, other: &ClientBuilder) -> bool
sourceimpl Serialize for ClientBuilder
impl Serialize for ClientBuilder
impl Eq for ClientBuilder
impl StructuralEq for ClientBuilder
impl StructuralPartialEq for ClientBuilder
Auto Trait Implementations
impl RefUnwindSafe for ClientBuilder
impl Send for ClientBuilder
impl Sync for ClientBuilder
impl Unpin for ClientBuilder
impl UnwindSafe for ClientBuilder
Blanket Implementations
sourceimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<Q, K> Equivalent<K> for Qwhere
Q: Eq + ?Sized,
K: Borrow<Q> + ?Sized,
impl<Q, K> Equivalent<K> for Qwhere
Q: Eq + ?Sized,
K: Borrow<Q> + ?Sized,
fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
sourceimpl<Q, K> Equivalent<K> for Qwhere
Q: Eq + ?Sized,
K: Borrow<Q> + ?Sized,
impl<Q, K> Equivalent<K> for Qwhere
Q: Eq + ?Sized,
K: Borrow<Q> + ?Sized,
sourcefn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key
and return true
if they are equal.