Struct subxt_lightclient::LightClient
source · pub struct LightClient { /* private fields */ }
Expand description
This represents a single light client connection to the network. Instantiate
it with LightClient::relay_chain()
to communicate with a relay chain, and
then call LightClient::parachain()
to establish connections to parachains.
Implementations§
source§impl LightClient
impl LightClient
sourcepub fn relay_chain<'a>(
chain_config: impl Into<ChainConfig<'a>>
) -> Result<(Self, LightClientRpc), LightClientError>
pub fn relay_chain<'a>( chain_config: impl Into<ChainConfig<'a>> ) -> Result<(Self, LightClientRpc), LightClientError>
Given a chain spec, establish a connection to a relay chain. Any subsequent calls to
LightClient::parachain()
will set this as the relay chain.
§Panics
The panic behaviour depends on the feature flag being used:
§Native
Panics when called outside of a tokio
runtime context.
§Web
If smoldot panics, then the promise created will be leaked. For more details, see https://docs.rs/wasm-bindgen-futures/latest/wasm_bindgen_futures/fn.future_to_promise.html.
sourcepub fn parachain<'a>(
&self,
chain_config: impl Into<ChainConfig<'a>>
) -> Result<LightClientRpc, LightClientError>
pub fn parachain<'a>( &self, chain_config: impl Into<ChainConfig<'a>> ) -> Result<LightClientRpc, LightClientError>
Given a chain spec, establish a connection to a parachain.
§Panics
The panic behaviour depends on the feature flag being used:
§Native
Panics when called outside of a tokio
runtime context.
§Web
If smoldot panics, then the promise created will be leaked. For more details, see https://docs.rs/wasm-bindgen-futures/latest/wasm_bindgen_futures/fn.future_to_promise.html.
Trait Implementations§
source§impl Clone for LightClient
impl Clone for LightClient
source§fn clone(&self) -> LightClient
fn clone(&self) -> LightClient
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moreAuto Trait Implementations§
impl Freeze for LightClient
impl RefUnwindSafe for LightClient
impl Send for LightClient
impl Sync for LightClient
impl Unpin for LightClient
impl UnwindSafe for LightClient
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> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait>
(where Trait: Downcast
) to Box<dyn Any>
. Box<dyn Any>
can
then be further downcast
into Box<ConcreteType>
where ConcreteType
implements Trait
.source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait>
(where Trait: Downcast
) to Rc<Any>
. Rc<Any>
can then be
further downcast
into Rc<ConcreteType>
where ConcreteType
implements Trait
.source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &Any
’s vtable from &Trait
’s.source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &mut Any
’s vtable from &mut Trait
’s.