pub struct TracingSinkClient { /* 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 TracingSinkClient
impl TracingSinkClient
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 new_span(&self, span: SpanMeta) -> Result<u64, RpcError>
pub async fn new_span(&self, span: SpanMeta) -> Result<u64, RpcError>
Call the #name method on the remote service.
Sourcepub async fn record(
&self,
span_id: u64,
fields: Vec<Field>,
) -> Result<(), RpcError>
pub async fn record( &self, span_id: u64, fields: Vec<Field>, ) -> Result<(), RpcError>
Call the #name method on the remote service.
Sourcepub async fn event(&self, event: EventMeta) -> Result<(), RpcError>
pub async fn event(&self, event: EventMeta) -> Result<(), RpcError>
Call the #name method on the remote service.
Sourcepub async fn enter(&self, span_id: u64) -> Result<(), RpcError>
pub async fn enter(&self, span_id: u64) -> Result<(), RpcError>
Call the #name method on the remote service.