pub struct ServiceIntrospectionClient { /* private fields */ }Expand description
Client stub for the #trait_name service.
This client uses hardcoded method IDs (1, 2, …) and expects an
Arc<RpcSession> whose
run task is already
running. Construct sessions with RpcSession::with_channel_start to
coordinate odd/even channel IDs when both peers initiate RPCs.
For multi-service scenarios where method IDs must be globally unique,
use [#registry_client_name] instead.
§Usage
let session = Arc::new(RpcSession::new(transport));
tokio::spawn(session.clone().run()); // Start the demux loop
let client = FooClient::new(session);
let result = client.some_method(args).await?;Implementations§
Source§impl ServiceIntrospectionClient
impl ServiceIntrospectionClient
Sourcepub fn new(session: Arc<RpcSession>) -> Self
pub fn new(session: Arc<RpcSession>) -> Self
Create a new client with the given RPC session.
Uses compile-time, on-wire method IDs (hashed Service.method).
For registry-resolved method IDs, use [#registry_client_name::new].
The provided session must be shared (Arc::clone) with the call site
and have its demux loop (tokio::spawn(session.clone().run())) running.
Sourcepub fn session(&self) -> &Arc<RpcSession>
pub fn session(&self) -> &Arc<RpcSession>
Get a reference to the underlying session.
Sourcepub async fn list_services(&self) -> Result<Vec<ServiceInfo>, RpcError>
pub async fn list_services(&self) -> Result<Vec<ServiceInfo>, RpcError>
Call the #name method on the remote service.
Sourcepub async fn describe_service(
&self,
name: String,
) -> Result<Option<ServiceInfo>, RpcError>
pub async fn describe_service( &self, name: String, ) -> Result<Option<ServiceInfo>, RpcError>
Call the #name method on the remote service.