use kanin::{extract::Msg, App};
use self::generated::{
echo_response::{Result, Success},
*,
};
async fn proto_handler(Msg(request): Msg<EchoRequest>) -> EchoResponse {
EchoResponse {
result: Some(Result::Success(Success {
value: request.value,
})),
}
}
#[tokio::test]
async fn it_compiles() {
let _ignore = App::new(())
.handler("routing_key", proto_handler)
.run("amqp_addr")
.await;
}
#[allow(clippy::derive_partial_eq_without_eq)]
mod generated {
use kanin::FromError;
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct InternalError {
#[prost(string, tag = "1")]
pub source: ::prost::alloc::string::String,
#[prost(string, tag = "2")]
pub error: ::prost::alloc::string::String,
}
#[derive(FromError, Clone, PartialEq, ::prost::Message)]
pub struct InvalidRequest {
#[prost(string, tag = "1")]
pub error: ::prost::alloc::string::String,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct EchoRequest {
#[prost(string, tag = "1")]
pub value: ::prost::alloc::string::String,
}
#[derive(FromError, Clone, PartialEq, ::prost::Message)]
pub struct EchoResponse {
#[prost(oneof = "echo_response::Result", tags = "1, 2")]
pub result: ::core::option::Option<echo_response::Result>,
}
pub mod echo_response {
use kanin_derive::FromError;
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct Success {
#[prost(string, tag = "1")]
pub value: ::prost::alloc::string::String,
}
#[derive(FromError, Clone, PartialEq, ::prost::Oneof)]
pub enum Result {
#[prost(message, tag = "1")]
Success(Success),
#[prost(message, tag = "2")]
InvalidRequest(super::InvalidRequest),
#[prost(message, tag = "3")]
InternalError(super::InternalError),
}
}
}