pub struct BlockchainConnectorBuilder<T>where
T: BlockchainConnector + Clone,{ /* private fields */ }
Expand description
A builder that can be used to build a BlockchainConnector with custom options.
Implementations§
source§impl<T> BlockchainConnectorBuilder<T>where
T: BlockchainConnector + Clone,
impl<T> BlockchainConnectorBuilder<T>where T: BlockchainConnector + Clone,
sourcepub fn new() -> Self
pub fn new() -> Self
Creates a new BlockchainConnectorBuilder with default options (no url and no connector type specified).
sourcepub fn url(&mut self, url: String) -> Self
pub fn url(&mut self, url: String) -> Self
Sets the url of the BlockchainConnectorBuilder.
sourcepub fn connector(&mut self, connector_type: ConnectorType<T>) -> Self
pub fn connector(&mut self, connector_type: ConnectorType<T>) -> Self
Sets the connector type of the BlockchainConnectorBuilder.
Use of this function requires that the associated struct of generic type T
that implement the BlockchainConnector trait be fully defined with data.
sourcepub fn build(&mut self) -> Result<T, Error>
pub fn build(&mut self) -> Result<T, Error>
Builds a BlockchainConnector struct using the options provided to the BlockchainConnectorBuilder
It returns a BlockchainConnector that can be used to connect to a blockchain. The result of that build later can be downcasted to a specific BlockchainConnector struct - any compatible struct that implements the BlockchainConnector trait.
Returns an error if neither the url or the connector type was specified.
Trait Implementations§
source§impl<T> Clone for BlockchainConnectorBuilder<T>where
T: BlockchainConnector + Clone + Clone,
impl<T> Clone for BlockchainConnectorBuilder<T>where T: BlockchainConnector + Clone + Clone,
source§fn clone(&self) -> BlockchainConnectorBuilder<T>
fn clone(&self) -> BlockchainConnectorBuilder<T>
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read more