Enum bdk::blockchain::any::AnyBlockchainConfig
source · [−]pub enum AnyBlockchainConfig {
Electrum(ElectrumBlockchainConfig),
Esplora(EsploraBlockchainConfig),
CompactFilters(CompactFiltersBlockchainConfig),
Rpc(RpcConfig),
}
Expand description
Type that can contain any of the blockchain configurations defined by the library
This allows storing a single configuration that can be loaded into an AnyBlockchain
instance. Wallets that plan to offer users the ability to switch blockchain backend at runtime
will find this particularly useful.
This type can be serialized from a JSON object like:
use bdk::blockchain::{electrum::ElectrumBlockchainConfig, AnyBlockchainConfig};
let config: AnyBlockchainConfig = serde_json::from_str(
r#"{
"type" : "electrum",
"url" : "ssl://electrum.blockstream.info:50002",
"retry": 2,
"stop_gap": 20
}"#,
)
.unwrap();
assert_eq!(
config,
AnyBlockchainConfig::Electrum(ElectrumBlockchainConfig {
url: "ssl://electrum.blockstream.info:50002".into(),
retry: 2,
socks5: None,
timeout: None,
stop_gap: 20,
})
);
Variants
Electrum(ElectrumBlockchainConfig)
electrum
only.Electrum client
Esplora(EsploraBlockchainConfig)
esplora
only.Esplora client
CompactFilters(CompactFiltersBlockchainConfig)
compact_filters
only.Compact filters client
Rpc(RpcConfig)
rpc
only.RPC client configuration
Trait Implementations
sourceimpl Clone for AnyBlockchainConfig
impl Clone for AnyBlockchainConfig
sourcefn clone(&self) -> AnyBlockchainConfig
fn clone(&self) -> AnyBlockchainConfig
Returns a copy of the value. Read more
1.0.0 · sourcefn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source
. Read more
sourceimpl Debug for AnyBlockchainConfig
impl Debug for AnyBlockchainConfig
sourceimpl<'de> Deserialize<'de> for AnyBlockchainConfig
impl<'de> Deserialize<'de> for AnyBlockchainConfig
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>,
Deserialize this value from the given Serde deserializer. Read more
sourceimpl From<CompactFiltersBlockchainConfig> for AnyBlockchainConfig
impl From<CompactFiltersBlockchainConfig> for AnyBlockchainConfig
sourcefn from(inner: CompactFiltersBlockchainConfig) -> Self
fn from(inner: CompactFiltersBlockchainConfig) -> Self
Converts to this type from the input type.
sourceimpl From<ElectrumBlockchainConfig> for AnyBlockchainConfig
impl From<ElectrumBlockchainConfig> for AnyBlockchainConfig
sourcefn from(inner: ElectrumBlockchainConfig) -> Self
fn from(inner: ElectrumBlockchainConfig) -> Self
Converts to this type from the input type.
sourceimpl From<EsploraBlockchainConfig> for AnyBlockchainConfig
impl From<EsploraBlockchainConfig> for AnyBlockchainConfig
sourcefn from(inner: EsploraBlockchainConfig) -> Self
fn from(inner: EsploraBlockchainConfig) -> Self
Converts to this type from the input type.
sourceimpl From<RpcConfig> for AnyBlockchainConfig
impl From<RpcConfig> for AnyBlockchainConfig
sourceimpl PartialEq<AnyBlockchainConfig> for AnyBlockchainConfig
impl PartialEq<AnyBlockchainConfig> for AnyBlockchainConfig
sourcefn eq(&self, other: &AnyBlockchainConfig) -> bool
fn eq(&self, other: &AnyBlockchainConfig) -> bool
This method tests for self
and other
values to be equal, and is used
by ==
. Read more
sourceimpl Serialize for AnyBlockchainConfig
impl Serialize for AnyBlockchainConfig
impl StructuralPartialEq for AnyBlockchainConfig
Auto Trait Implementations
impl RefUnwindSafe for AnyBlockchainConfig
impl Send for AnyBlockchainConfig
impl Sync for AnyBlockchainConfig
impl Unpin for AnyBlockchainConfig
impl UnwindSafe for AnyBlockchainConfig
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
Mutably borrows from an owned value. Read more