pub struct MethodBuilder { /* private fields */ }
Expand description

Method builder.

This builder can be used to manually define gRPC method, which can be added to a gRPC service, in rust code without the use of a .proto file.

Example

let say_hello_method = Method::builder()
    .name("say_hello")
    .route_name("SayHello")
    // Provide the path to the Request type
    .input_type("crate::common::HelloRequest")
    // Provide the path to the Response type
    .output_type("crate::common::HelloResponse")
    // Provide the path to the Codec to use
    .codec_path("crate::common::JsonCodec")
    .build();

Implementations§

Set the name for this Method.

This value will be used for generating the client functions for calling this Method.

Generally this is formatted in snake_case.

Set the route_name for this Method.

This value will be used as part of the route for calling this method. Routes have the form: /<package_name>.<service_name>/<method_route_name>

Generally this is formatted in PascalCase.

Add a comment string that should be included as a doc comment for this Method.

Set the path to the Rust type that should be use for the Request type of this method.

Set the path to the Rust type that should be use for the Response type of this method.

Set the path to the Rust type that should be used as the Codec for this method.

Currently the codegen assumes that this type implements Default.

Sets if the Method request from the client is streamed.

Sets if the Method response from the server is streamed.

Build a Method

Panics if name, route_name, input_type, output_type, or codec_path weren’t set.

Trait Implementations§

Formats the value using the given formatter. Read more
Returns the “default value” for a type. Read more

Auto Trait Implementations§

Blanket Implementations§

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.