Struct wasmcloud_core::wrpc::Client
source · pub struct Client { /* private fields */ }
Expand description
Wrapper around wrpc_transport_nats::Client
that includes a async_nats::HeaderMap
for
passing invocation and trace context.
Implementations§
source§impl Client
impl Client
sourcepub fn new(
nats: impl Into<Arc<Client>>,
lattice: &str,
component_id: &str,
headers: HeaderMap,
timeout: Duration
) -> Self
pub fn new( nats: impl Into<Arc<Client>>, lattice: &str, component_id: &str, headers: HeaderMap, timeout: Duration ) -> Self
Create a new wRPC Client with the given NATS client, lattice, component ID, and headers.
§Arguments
nats
- The NATS client to use for communication.lattice
- The lattice ID to use for communication.prefix
- The component ID to use for communication.headers
- The headers to include with each outbound invocation.
Trait Implementations§
source§impl Client for Client
impl Client for Client
type Context = Option<HeaderMap>
type Subject = Subject
type Subscriber = Subscriber
type Transmission = Transmission
type Acceptor = AcceptorWithHeaders
type Invocation = InvocationWithHeaders
type InvocationStream<T> = Pin<Box<dyn Stream<Item = Result<AcceptedInvocation<Option<HeaderMap>, T, TransmitterWithHeaders>, Error>> + Send>>
source§async fn serve<T, S, Fut>(
&self,
instance: &str,
name: &str,
svc: S
) -> Result<Self::InvocationStream<T>>where
S: Service<IncomingInvocation<Option<HeaderMap>, Subscriber, AcceptorWithHeaders>, Future = Fut> + Send + Clone + 'static,
Fut: Future<Output = Result<AcceptedInvocation<Option<HeaderMap>, T, TransmitterWithHeaders>>> + Send,
async fn serve<T, S, Fut>(
&self,
instance: &str,
name: &str,
svc: S
) -> Result<Self::InvocationStream<T>>where
S: Service<IncomingInvocation<Option<HeaderMap>, Subscriber, AcceptorWithHeaders>, Future = Fut> + Send + Clone + 'static,
Fut: Future<Output = Result<AcceptedInvocation<Option<HeaderMap>, T, TransmitterWithHeaders>>> + Send,
Serve function
name
from instance instance
source§fn new_invocation(
&self
) -> OutgoingInvocation<Self::Invocation, Self::Subscriber, Self::Subject>
fn new_invocation( &self ) -> OutgoingInvocation<Self::Invocation, Self::Subscriber, Self::Subject>
Constructs a new invocation to be sent to peer
source§fn serve_static<T>(
&self,
instance: &str,
name: &str
) -> impl Future<Output = Result<Self::InvocationStream<T>, Error>> + Send
fn serve_static<T>( &self, instance: &str, name: &str ) -> impl Future<Output = Result<Self::InvocationStream<T>, Error>> + Send
Serve function
name
from instance instance
with statically-typed parameter type T
.source§fn serve_dynamic(
&self,
instance: &str,
name: &str,
params: Arc<[Type]>
) -> impl Future<Output = Result<Self::InvocationStream<Vec<Value>>, Error>> + Send
fn serve_dynamic( &self, instance: &str, name: &str, params: Arc<[Type]> ) -> impl Future<Output = Result<Self::InvocationStream<Vec<Value>>, Error>> + Send
Serve function
name
from instance instance
with dynamically-typed parameter type
params
.Auto Trait Implementations§
impl Freeze for Client
impl !RefUnwindSafe for Client
impl Send for Client
impl Sync for Client
impl Unpin for Client
impl !UnwindSafe for Client
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
Mutably borrows from an owned value. Read more