Trait ForNetwork

Source
pub trait ForNetwork {
    type Net: Network;

    // Required methods
    fn network(&self) -> Self::Net;
    fn component(&self) -> &'static str;
}
Expand description

Associates a type with a particular type of RPC networks, such as Ethereum or ZKsync Era. RPC traits created using jsonrpsee::rpc can use ForNetwork as a client boundary to restrict which implementations can call their methods.

Required Associated Types§

Source

type Net: Network

Network that the type is associated with.

Required Methods§

Source

fn network(&self) -> Self::Net

Returns a network for this type instance.

Source

fn component(&self) -> &'static str

Returns the component tag. The component name can be used in logging, metrics etc. The component name should be copied to the clones of this client, but should not be passed upstream.

Implementations on Foreign Types§

Source§

impl<T: ?Sized + ForNetwork> ForNetwork for &T

Source§

type Net = <T as ForNetwork>::Net

Source§

fn network(&self) -> Self::Net

Source§

fn component(&self) -> &'static str

Source§

impl<T: ?Sized + ForNetwork> ForNetwork for Box<T>

Source§

type Net = <T as ForNetwork>::Net

Source§

fn network(&self) -> Self::Net

Source§

fn component(&self) -> &'static str

Implementors§

Source§

impl<Net: Network> ForNetwork for MockClient<Net>

Source§

type Net = Net

Source§

impl<Net: Network, C: ClientBase> ForNetwork for Client<Net, C>

Source§

type Net = Net