Skip to main content

IntoRequest

Trait IntoRequest 

pub trait IntoRequest<T>: Sealed {
    // Required method
    fn into_request(self) -> Request<T>;
}
Available on crate features grpc and http only.
Expand description

Trait implemented by RPC request types.

Types implementing this trait can be used as arguments to client RPC methods without explicitly wrapping them into rama_grpc::Requests. The purpose is to make client calls slightly more convenient to write.

Code generation and blanket implementations handle this for you, so it is not necessary to implement this trait directly.

§Example

Given the following gRPC method definition:

rpc GetFeature(Point) returns (Feature) {}

we can call get_feature in two equivalent ways:

use rama_grpc::Request;

client.get_feature(Point {});
client.get_feature(Request::new(Point {}));

Required Methods§

fn into_request(self) -> Request<T>

Wrap the input message T in a rama_grpc::Request

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§

§

impl<T> IntoRequest<T> for Request<T>

§

impl<T> IntoRequest<T> for T