tonic_build

Trait Method

source
pub trait Method {
    type Comment: AsRef<str>;

    // Required methods
    fn name(&self) -> &str;
    fn identifier(&self) -> &str;
    fn codec_path(&self) -> &str;
    fn client_streaming(&self) -> bool;
    fn server_streaming(&self) -> bool;
    fn comment(&self) -> &[Self::Comment];
    fn request_response_name(
        &self,
        proto_path: &str,
        compile_well_known_types: bool,
    ) -> (TokenStream, TokenStream);

    // Provided method
    fn deprecated(&self) -> bool { ... }
}
Expand description

Method generation trait.

Each service contains a set of generic Methods’s that will be used by codegen to generate abstraction implementations for the provided methods.

Required Associated Types§

source

type Comment: AsRef<str>

Comment type.

Required Methods§

source

fn name(&self) -> &str

Name of method.

source

fn identifier(&self) -> &str

Identifier used to generate type name.

source

fn codec_path(&self) -> &str

Path to the codec.

source

fn client_streaming(&self) -> bool

Method is streamed by client.

source

fn server_streaming(&self) -> bool

Method is streamed by server.

source

fn comment(&self) -> &[Self::Comment]

Get comments about this item.

source

fn request_response_name( &self, proto_path: &str, compile_well_known_types: bool, ) -> (TokenStream, TokenStream)

Type name of request and response.

Provided Methods§

source

fn deprecated(&self) -> bool

Method is deprecated.

Implementors§