#[derive(Clone, PartialEq, ::prost::Message)]
pub struct CodeReply {
#[prost(string, tag = "1")]
pub id: ::prost::alloc::string::String,
#[prost(string, tag = "2")]
pub id1: ::prost::alloc::string::String,
#[prost(int64, tag = "3")]
pub code: i64,
#[prost(string, tag = "4")]
pub message_s: ::prost::alloc::string::String,
}
impl ::prost::Name for CodeReply {
const NAME: &'static str = "CodeReply";
const PACKAGE: &'static str = "bilibili.api.probe.v1";
fn full_name() -> ::prost::alloc::string::String {
"bilibili.api.probe.v1.CodeReply".into()
}
fn type_url() -> ::prost::alloc::string::String {
"/bilibili.api.probe.v1.CodeReply".into()
}
}
#[derive(Clone, Copy, PartialEq, ::prost::Message)]
pub struct CodeReq {
#[prost(int64, tag = "1")]
pub code: i64,
}
impl ::prost::Name for CodeReq {
const NAME: &'static str = "CodeReq";
const PACKAGE: &'static str = "bilibili.api.probe.v1";
fn full_name() -> ::prost::alloc::string::String {
"bilibili.api.probe.v1.CodeReq".into()
}
fn type_url() -> ::prost::alloc::string::String {
"/bilibili.api.probe.v1.CodeReq".into()
}
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct CreatTask {
#[prost(string, tag = "1")]
pub name: ::prost::alloc::string::String,
}
impl ::prost::Name for CreatTask {
const NAME: &'static str = "CreatTask";
const PACKAGE: &'static str = "bilibili.api.probe.v1";
fn full_name() -> ::prost::alloc::string::String {
"bilibili.api.probe.v1.CreatTask".into()
}
fn type_url() -> ::prost::alloc::string::String {
"/bilibili.api.probe.v1.CreatTask".into()
}
}
#[derive(Clone, Copy, PartialEq, ::prost::Message)]
pub struct CreateTopic {
#[prost(int64, tag = "1")]
pub id: i64,
}
impl ::prost::Name for CreateTopic {
const NAME: &'static str = "CreateTopic";
const PACKAGE: &'static str = "bilibili.api.probe.v1";
fn full_name() -> ::prost::alloc::string::String {
"bilibili.api.probe.v1.CreateTopic".into()
}
fn type_url() -> ::prost::alloc::string::String {
"/bilibili.api.probe.v1.CreateTopic".into()
}
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct DynamicMessageUpdate {
#[prost(message, optional, tag = "1")]
pub body: ::core::option::Option<SimpleMessage>,
}
impl ::prost::Name for DynamicMessageUpdate {
const NAME: &'static str = "DynamicMessageUpdate";
const PACKAGE: &'static str = "bilibili.api.probe.v1";
fn full_name() -> ::prost::alloc::string::String {
"bilibili.api.probe.v1.DynamicMessageUpdate".into()
}
fn type_url() -> ::prost::alloc::string::String {
"/bilibili.api.probe.v1.DynamicMessageUpdate".into()
}
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct Embedded {
#[prost(bool, tag = "1")]
pub bool_val: bool,
#[prost(int32, tag = "2")]
pub int32_val: i32,
#[prost(int64, tag = "3")]
pub int64_val: i64,
#[prost(float, tag = "4")]
pub float_val: f32,
#[prost(double, tag = "5")]
pub double_val: f64,
#[prost(string, tag = "6")]
pub string_val: ::prost::alloc::string::String,
#[prost(bool, repeated, tag = "7")]
pub repeated_bool_val: ::prost::alloc::vec::Vec<bool>,
#[prost(int32, repeated, tag = "8")]
pub repeated_int32_val: ::prost::alloc::vec::Vec<i32>,
#[prost(int64, repeated, tag = "9")]
pub repeated_int64_val: ::prost::alloc::vec::Vec<i64>,
#[prost(float, repeated, tag = "10")]
pub repeated_float_val: ::prost::alloc::vec::Vec<f32>,
#[prost(double, repeated, tag = "11")]
pub repeated_double_val: ::prost::alloc::vec::Vec<f64>,
#[prost(string, repeated, tag = "12")]
pub repeated_string_val: ::prost::alloc::vec::Vec<::prost::alloc::string::String>,
#[prost(map = "string, string", tag = "13")]
pub map_string_val: ::std::collections::HashMap<
::prost::alloc::string::String,
::prost::alloc::string::String,
>,
#[prost(map = "string, message", tag = "14")]
pub map_error_val: ::std::collections::HashMap<
::prost::alloc::string::String,
ErrorMessage,
>,
}
impl ::prost::Name for Embedded {
const NAME: &'static str = "Embedded";
const PACKAGE: &'static str = "bilibili.api.probe.v1";
fn full_name() -> ::prost::alloc::string::String {
"bilibili.api.probe.v1.Embedded".into()
}
fn type_url() -> ::prost::alloc::string::String {
"/bilibili.api.probe.v1.Embedded".into()
}
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct ErrorMessage {
#[prost(int64, tag = "1")]
pub code: i64,
#[prost(string, tag = "2")]
pub reason: ::prost::alloc::string::String,
#[prost(string, tag = "3")]
pub message: ::prost::alloc::string::String,
}
impl ::prost::Name for ErrorMessage {
const NAME: &'static str = "ErrorMessage";
const PACKAGE: &'static str = "bilibili.api.probe.v1";
fn full_name() -> ::prost::alloc::string::String {
"bilibili.api.probe.v1.ErrorMessage".into()
}
fn type_url() -> ::prost::alloc::string::String {
"/bilibili.api.probe.v1.ErrorMessage".into()
}
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct ProbeReply {
#[prost(string, tag = "1")]
pub content: ::prost::alloc::string::String,
#[prost(int64, tag = "2")]
pub timestamp: i64,
}
impl ::prost::Name for ProbeReply {
const NAME: &'static str = "ProbeReply";
const PACKAGE: &'static str = "bilibili.api.probe.v1";
fn full_name() -> ::prost::alloc::string::String {
"bilibili.api.probe.v1.ProbeReply".into()
}
fn type_url() -> ::prost::alloc::string::String {
"/bilibili.api.probe.v1.ProbeReply".into()
}
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct ProbeReq {
#[prost(int64, tag = "1")]
pub mid: i64,
#[prost(string, tag = "2")]
pub buvid: ::prost::alloc::string::String,
}
impl ::prost::Name for ProbeReq {
const NAME: &'static str = "ProbeReq";
const PACKAGE: &'static str = "bilibili.api.probe.v1";
fn full_name() -> ::prost::alloc::string::String {
"bilibili.api.probe.v1.ProbeReq".into()
}
fn type_url() -> ::prost::alloc::string::String {
"/bilibili.api.probe.v1.ProbeReq".into()
}
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct ProbeStreamReply {
#[prost(int64, tag = "1")]
pub sequence: i64,
#[prost(int64, tag = "2")]
pub timestamp: i64,
#[prost(string, tag = "3")]
pub content: ::prost::alloc::string::String,
}
impl ::prost::Name for ProbeStreamReply {
const NAME: &'static str = "ProbeStreamReply";
const PACKAGE: &'static str = "bilibili.api.probe.v1";
fn full_name() -> ::prost::alloc::string::String {
"bilibili.api.probe.v1.ProbeStreamReply".into()
}
fn type_url() -> ::prost::alloc::string::String {
"/bilibili.api.probe.v1.ProbeStreamReply".into()
}
}
#[derive(Clone, Copy, PartialEq, ::prost::Message)]
pub struct ProbeStreamReq {
#[prost(int64, tag = "1")]
pub mid: i64,
#[prost(int64, tag = "2")]
pub sequence: i64,
}
impl ::prost::Name for ProbeStreamReq {
const NAME: &'static str = "ProbeStreamReq";
const PACKAGE: &'static str = "bilibili.api.probe.v1";
fn full_name() -> ::prost::alloc::string::String {
"bilibili.api.probe.v1.ProbeStreamReq".into()
}
fn type_url() -> ::prost::alloc::string::String {
"/bilibili.api.probe.v1.ProbeStreamReq".into()
}
}
#[derive(Clone, Copy, PartialEq, ::prost::Message)]
pub struct ProbeSubReply {
#[prost(int64, tag = "1")]
pub message_id: i64,
}
impl ::prost::Name for ProbeSubReply {
const NAME: &'static str = "ProbeSubReply";
const PACKAGE: &'static str = "bilibili.api.probe.v1";
fn full_name() -> ::prost::alloc::string::String {
"bilibili.api.probe.v1.ProbeSubReply".into()
}
fn type_url() -> ::prost::alloc::string::String {
"/bilibili.api.probe.v1.ProbeSubReply".into()
}
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct ProbeSubReq {
#[prost(string, tag = "1")]
pub buvid: ::prost::alloc::string::String,
}
impl ::prost::Name for ProbeSubReq {
const NAME: &'static str = "ProbeSubReq";
const PACKAGE: &'static str = "bilibili.api.probe.v1";
fn full_name() -> ::prost::alloc::string::String {
"bilibili.api.probe.v1.ProbeSubReq".into()
}
fn type_url() -> ::prost::alloc::string::String {
"/bilibili.api.probe.v1.ProbeSubReq".into()
}
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct SimpleMessage {
#[prost(int32, tag = "1")]
pub id: i32,
#[prost(int64, tag = "2")]
pub num: i64,
#[prost(string, tag = "3")]
pub lang: ::prost::alloc::string::String,
#[prost(enumeration = "Category", tag = "4")]
pub cate: i32,
#[prost(message, optional, tag = "5")]
pub embedded: ::core::option::Option<Embedded>,
}
impl ::prost::Name for SimpleMessage {
const NAME: &'static str = "SimpleMessage";
const PACKAGE: &'static str = "bilibili.api.probe.v1";
fn full_name() -> ::prost::alloc::string::String {
"bilibili.api.probe.v1.SimpleMessage".into()
}
fn type_url() -> ::prost::alloc::string::String {
"/bilibili.api.probe.v1.SimpleMessage".into()
}
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct Task {
#[prost(string, tag = "1")]
pub name: ::prost::alloc::string::String,
#[prost(string, tag = "2")]
pub author: ::prost::alloc::string::String,
#[prost(bool, tag = "3")]
pub cache: bool,
}
impl ::prost::Name for Task {
const NAME: &'static str = "Task";
const PACKAGE: &'static str = "bilibili.api.probe.v1";
fn full_name() -> ::prost::alloc::string::String {
"bilibili.api.probe.v1.Task".into()
}
fn type_url() -> ::prost::alloc::string::String {
"/bilibili.api.probe.v1.Task".into()
}
}
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
#[repr(i32)]
pub enum Category {
Unspecified = 0,
One = 1,
Two = 2,
Three = 3,
Four = 4,
}
impl Category {
pub fn as_str_name(&self) -> &'static str {
match self {
Self::Unspecified => "CATEGORY_UNSPECIFIED",
Self::One => "CATEGORY_ONE",
Self::Two => "CATEGORY_TWO",
Self::Three => "CATEGORY_THREE",
Self::Four => "CATEGORY_FOUR",
}
}
pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
match value {
"CATEGORY_UNSPECIFIED" => Some(Self::Unspecified),
"CATEGORY_ONE" => Some(Self::One),
"CATEGORY_TWO" => Some(Self::Two),
"CATEGORY_THREE" => Some(Self::Three),
"CATEGORY_FOUR" => Some(Self::Four),
_ => None,
}
}
}
#[cfg(feature = "feat-enable-generated-client")]
pub mod probe_client {
#![allow(
unused_variables,
dead_code,
missing_docs,
clippy::wildcard_imports,
clippy::let_unit_value,
)]
use tonic::codegen::*;
use tonic::codegen::http::Uri;
#[derive(Debug, Clone)]
pub struct ProbeClient<T> {
inner: tonic::client::Grpc<T>,
}
impl<T> ProbeClient<T>
where
T: tonic::client::GrpcService<tonic::body::Body>,
T::Error: Into<StdError>,
T::ResponseBody: Body<Data = Bytes> + std::marker::Send + 'static,
<T::ResponseBody as Body>::Error: Into<StdError> + std::marker::Send,
{
pub fn new(inner: T) -> Self {
let inner = tonic::client::Grpc::new(inner);
Self { inner }
}
pub fn with_origin(inner: T, origin: Uri) -> Self {
let inner = tonic::client::Grpc::with_origin(inner, origin);
Self { inner }
}
pub fn with_interceptor<F>(
inner: T,
interceptor: F,
) -> ProbeClient<InterceptedService<T, F>>
where
F: tonic::service::Interceptor,
T::ResponseBody: Default,
T: tonic::codegen::Service<
http::Request<tonic::body::Body>,
Response = http::Response<
<T as tonic::client::GrpcService<tonic::body::Body>>::ResponseBody,
>,
>,
<T as tonic::codegen::Service<
http::Request<tonic::body::Body>,
>>::Error: Into<StdError> + std::marker::Send + std::marker::Sync,
{
ProbeClient::new(InterceptedService::new(inner, interceptor))
}
#[must_use]
pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
self.inner = self.inner.send_compressed(encoding);
self
}
#[must_use]
pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
self.inner = self.inner.accept_compressed(encoding);
self
}
#[must_use]
pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
self.inner = self.inner.max_decoding_message_size(limit);
self
}
#[must_use]
pub fn max_encoding_message_size(mut self, limit: usize) -> Self {
self.inner = self.inner.max_encoding_message_size(limit);
self
}
pub async fn test_code(
&mut self,
request: impl tonic::IntoRequest<super::CodeReq>,
) -> std::result::Result<tonic::Response<super::CodeReply>, tonic::Status> {
self.inner
.ready()
.await
.map_err(|e| {
tonic::Status::unknown(
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic::codec::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/bilibili.api.probe.v1.Probe/TestCode",
);
let mut req = request.into_request();
req.extensions_mut()
.insert(GrpcMethod::new("bilibili.api.probe.v1.Probe", "TestCode"));
self.inner.unary(req, path, codec).await
}
pub async fn test_req(
&mut self,
request: impl tonic::IntoRequest<super::ProbeReq>,
) -> std::result::Result<tonic::Response<super::ProbeReply>, tonic::Status> {
self.inner
.ready()
.await
.map_err(|e| {
tonic::Status::unknown(
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic::codec::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/bilibili.api.probe.v1.Probe/TestReq",
);
let mut req = request.into_request();
req.extensions_mut()
.insert(GrpcMethod::new("bilibili.api.probe.v1.Probe", "TestReq"));
self.inner.unary(req, path, codec).await
}
pub async fn test_stream(
&mut self,
request: impl tonic::IntoStreamingRequest<Message = super::ProbeStreamReq>,
) -> std::result::Result<
tonic::Response<tonic::codec::Streaming<super::ProbeStreamReply>>,
tonic::Status,
> {
self.inner
.ready()
.await
.map_err(|e| {
tonic::Status::unknown(
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic::codec::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/bilibili.api.probe.v1.Probe/TestStream",
);
let mut req = request.into_streaming_request();
req.extensions_mut()
.insert(GrpcMethod::new("bilibili.api.probe.v1.Probe", "TestStream"));
self.inner.streaming(req, path, codec).await
}
pub async fn test_sub(
&mut self,
request: impl tonic::IntoRequest<super::ProbeSubReq>,
) -> std::result::Result<
tonic::Response<tonic::codec::Streaming<super::ProbeSubReply>>,
tonic::Status,
> {
self.inner
.ready()
.await
.map_err(|e| {
tonic::Status::unknown(
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic::codec::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/bilibili.api.probe.v1.Probe/TestSub",
);
let mut req = request.into_request();
req.extensions_mut()
.insert(GrpcMethod::new("bilibili.api.probe.v1.Probe", "TestSub"));
self.inner.server_streaming(req, path, codec).await
}
}
}
#[cfg(feature = "feat-enable-generated-client")]
pub mod probe_service_client {
#![allow(
unused_variables,
dead_code,
missing_docs,
clippy::wildcard_imports,
clippy::let_unit_value,
)]
use tonic::codegen::*;
use tonic::codegen::http::Uri;
#[derive(Debug, Clone)]
pub struct ProbeServiceClient<T> {
inner: tonic::client::Grpc<T>,
}
impl<T> ProbeServiceClient<T>
where
T: tonic::client::GrpcService<tonic::body::Body>,
T::Error: Into<StdError>,
T::ResponseBody: Body<Data = Bytes> + std::marker::Send + 'static,
<T::ResponseBody as Body>::Error: Into<StdError> + std::marker::Send,
{
pub fn new(inner: T) -> Self {
let inner = tonic::client::Grpc::new(inner);
Self { inner }
}
pub fn with_origin(inner: T, origin: Uri) -> Self {
let inner = tonic::client::Grpc::with_origin(inner, origin);
Self { inner }
}
pub fn with_interceptor<F>(
inner: T,
interceptor: F,
) -> ProbeServiceClient<InterceptedService<T, F>>
where
F: tonic::service::Interceptor,
T::ResponseBody: Default,
T: tonic::codegen::Service<
http::Request<tonic::body::Body>,
Response = http::Response<
<T as tonic::client::GrpcService<tonic::body::Body>>::ResponseBody,
>,
>,
<T as tonic::codegen::Service<
http::Request<tonic::body::Body>,
>>::Error: Into<StdError> + std::marker::Send + std::marker::Sync,
{
ProbeServiceClient::new(InterceptedService::new(inner, interceptor))
}
#[must_use]
pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
self.inner = self.inner.send_compressed(encoding);
self
}
#[must_use]
pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
self.inner = self.inner.accept_compressed(encoding);
self
}
#[must_use]
pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
self.inner = self.inner.max_decoding_message_size(limit);
self
}
#[must_use]
pub fn max_encoding_message_size(mut self, limit: usize) -> Self {
self.inner = self.inner.max_encoding_message_size(limit);
self
}
pub async fn echo(
&mut self,
request: impl tonic::IntoRequest<super::SimpleMessage>,
) -> std::result::Result<tonic::Response<super::SimpleMessage>, tonic::Status> {
self.inner
.ready()
.await
.map_err(|e| {
tonic::Status::unknown(
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic::codec::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/bilibili.api.probe.v1.ProbeService/Echo",
);
let mut req = request.into_request();
req.extensions_mut()
.insert(GrpcMethod::new("bilibili.api.probe.v1.ProbeService", "Echo"));
self.inner.unary(req, path, codec).await
}
pub async fn echo_body(
&mut self,
request: impl tonic::IntoRequest<super::SimpleMessage>,
) -> std::result::Result<tonic::Response<super::SimpleMessage>, tonic::Status> {
self.inner
.ready()
.await
.map_err(|e| {
tonic::Status::unknown(
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic::codec::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/bilibili.api.probe.v1.ProbeService/EchoBody",
);
let mut req = request.into_request();
req.extensions_mut()
.insert(
GrpcMethod::new("bilibili.api.probe.v1.ProbeService", "EchoBody"),
);
self.inner.unary(req, path, codec).await
}
pub async fn echo_delete(
&mut self,
request: impl tonic::IntoRequest<super::SimpleMessage>,
) -> std::result::Result<tonic::Response<super::SimpleMessage>, tonic::Status> {
self.inner
.ready()
.await
.map_err(|e| {
tonic::Status::unknown(
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic::codec::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/bilibili.api.probe.v1.ProbeService/EchoDelete",
);
let mut req = request.into_request();
req.extensions_mut()
.insert(
GrpcMethod::new("bilibili.api.probe.v1.ProbeService", "EchoDelete"),
);
self.inner.unary(req, path, codec).await
}
pub async fn echo_error(
&mut self,
request: impl tonic::IntoRequest<super::ErrorMessage>,
) -> std::result::Result<tonic::Response<super::ErrorMessage>, tonic::Status> {
self.inner
.ready()
.await
.map_err(|e| {
tonic::Status::unknown(
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic::codec::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/bilibili.api.probe.v1.ProbeService/EchoError",
);
let mut req = request.into_request();
req.extensions_mut()
.insert(
GrpcMethod::new("bilibili.api.probe.v1.ProbeService", "EchoError"),
);
self.inner.unary(req, path, codec).await
}
pub async fn echo_patch(
&mut self,
request: impl tonic::IntoRequest<super::DynamicMessageUpdate>,
) -> std::result::Result<
tonic::Response<super::DynamicMessageUpdate>,
tonic::Status,
> {
self.inner
.ready()
.await
.map_err(|e| {
tonic::Status::unknown(
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic::codec::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/bilibili.api.probe.v1.ProbeService/EchoPatch",
);
let mut req = request.into_request();
req.extensions_mut()
.insert(
GrpcMethod::new("bilibili.api.probe.v1.ProbeService", "EchoPatch"),
);
self.inner.unary(req, path, codec).await
}
}
}
#[cfg(feature = "feat-enable-generated-server")]
pub mod probe_server {
#![allow(
unused_variables,
dead_code,
missing_docs,
clippy::wildcard_imports,
clippy::let_unit_value,
)]
use tonic::codegen::*;
#[async_trait]
pub trait Probe: std::marker::Send + std::marker::Sync + 'static {
async fn test_code(
&self,
request: tonic::Request<super::CodeReq>,
) -> std::result::Result<tonic::Response<super::CodeReply>, tonic::Status>;
async fn test_req(
&self,
request: tonic::Request<super::ProbeReq>,
) -> std::result::Result<tonic::Response<super::ProbeReply>, tonic::Status>;
type TestStreamStream: tonic::codegen::tokio_stream::Stream<
Item = std::result::Result<super::ProbeStreamReply, tonic::Status>,
>
+ std::marker::Send
+ 'static;
async fn test_stream(
&self,
request: tonic::Request<tonic::Streaming<super::ProbeStreamReq>>,
) -> std::result::Result<tonic::Response<Self::TestStreamStream>, tonic::Status>;
type TestSubStream: tonic::codegen::tokio_stream::Stream<
Item = std::result::Result<super::ProbeSubReply, tonic::Status>,
>
+ std::marker::Send
+ 'static;
async fn test_sub(
&self,
request: tonic::Request<super::ProbeSubReq>,
) -> std::result::Result<tonic::Response<Self::TestSubStream>, tonic::Status>;
}
#[derive(Debug)]
pub struct ProbeServer<T> {
inner: Arc<T>,
accept_compression_encodings: EnabledCompressionEncodings,
send_compression_encodings: EnabledCompressionEncodings,
max_decoding_message_size: Option<usize>,
max_encoding_message_size: Option<usize>,
}
impl<T> ProbeServer<T> {
pub fn new(inner: T) -> Self {
Self::from_arc(Arc::new(inner))
}
pub fn from_arc(inner: Arc<T>) -> Self {
Self {
inner,
accept_compression_encodings: Default::default(),
send_compression_encodings: Default::default(),
max_decoding_message_size: None,
max_encoding_message_size: None,
}
}
pub fn with_interceptor<F>(
inner: T,
interceptor: F,
) -> InterceptedService<Self, F>
where
F: tonic::service::Interceptor,
{
InterceptedService::new(Self::new(inner), interceptor)
}
#[must_use]
pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
self.accept_compression_encodings.enable(encoding);
self
}
#[must_use]
pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
self.send_compression_encodings.enable(encoding);
self
}
#[must_use]
pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
self.max_decoding_message_size = Some(limit);
self
}
#[must_use]
pub fn max_encoding_message_size(mut self, limit: usize) -> Self {
self.max_encoding_message_size = Some(limit);
self
}
}
impl<T, B> tonic::codegen::Service<http::Request<B>> for ProbeServer<T>
where
T: Probe,
B: Body + std::marker::Send + 'static,
B::Error: Into<StdError> + std::marker::Send + 'static,
{
type Response = http::Response<tonic::body::Body>;
type Error = std::convert::Infallible;
type Future = BoxFuture<Self::Response, Self::Error>;
fn poll_ready(
&mut self,
_cx: &mut Context<'_>,
) -> Poll<std::result::Result<(), Self::Error>> {
Poll::Ready(Ok(()))
}
fn call(&mut self, req: http::Request<B>) -> Self::Future {
match req.uri().path() {
"/bilibili.api.probe.v1.Probe/TestCode" => {
#[allow(non_camel_case_types)]
struct TestCodeSvc<T: Probe>(pub Arc<T>);
impl<T: Probe> tonic::server::UnaryService<super::CodeReq>
for TestCodeSvc<T> {
type Response = super::CodeReply;
type Future = BoxFuture<
tonic::Response<Self::Response>,
tonic::Status,
>;
fn call(
&mut self,
request: tonic::Request<super::CodeReq>,
) -> Self::Future {
let inner = Arc::clone(&self.0);
let fut = async move {
<T as Probe>::test_code(&inner, request).await
};
Box::pin(fut)
}
}
let accept_compression_encodings = self.accept_compression_encodings;
let send_compression_encodings = self.send_compression_encodings;
let max_decoding_message_size = self.max_decoding_message_size;
let max_encoding_message_size = self.max_encoding_message_size;
let inner = self.inner.clone();
let fut = async move {
let method = TestCodeSvc(inner);
let codec = tonic::codec::ProstCodec::default();
let mut grpc = tonic::server::Grpc::new(codec)
.apply_compression_config(
accept_compression_encodings,
send_compression_encodings,
)
.apply_max_message_size_config(
max_decoding_message_size,
max_encoding_message_size,
);
let res = grpc.unary(method, req).await;
Ok(res)
};
Box::pin(fut)
}
"/bilibili.api.probe.v1.Probe/TestReq" => {
#[allow(non_camel_case_types)]
struct TestReqSvc<T: Probe>(pub Arc<T>);
impl<T: Probe> tonic::server::UnaryService<super::ProbeReq>
for TestReqSvc<T> {
type Response = super::ProbeReply;
type Future = BoxFuture<
tonic::Response<Self::Response>,
tonic::Status,
>;
fn call(
&mut self,
request: tonic::Request<super::ProbeReq>,
) -> Self::Future {
let inner = Arc::clone(&self.0);
let fut = async move {
<T as Probe>::test_req(&inner, request).await
};
Box::pin(fut)
}
}
let accept_compression_encodings = self.accept_compression_encodings;
let send_compression_encodings = self.send_compression_encodings;
let max_decoding_message_size = self.max_decoding_message_size;
let max_encoding_message_size = self.max_encoding_message_size;
let inner = self.inner.clone();
let fut = async move {
let method = TestReqSvc(inner);
let codec = tonic::codec::ProstCodec::default();
let mut grpc = tonic::server::Grpc::new(codec)
.apply_compression_config(
accept_compression_encodings,
send_compression_encodings,
)
.apply_max_message_size_config(
max_decoding_message_size,
max_encoding_message_size,
);
let res = grpc.unary(method, req).await;
Ok(res)
};
Box::pin(fut)
}
"/bilibili.api.probe.v1.Probe/TestStream" => {
#[allow(non_camel_case_types)]
struct TestStreamSvc<T: Probe>(pub Arc<T>);
impl<T: Probe> tonic::server::StreamingService<super::ProbeStreamReq>
for TestStreamSvc<T> {
type Response = super::ProbeStreamReply;
type ResponseStream = T::TestStreamStream;
type Future = BoxFuture<
tonic::Response<Self::ResponseStream>,
tonic::Status,
>;
fn call(
&mut self,
request: tonic::Request<
tonic::Streaming<super::ProbeStreamReq>,
>,
) -> Self::Future {
let inner = Arc::clone(&self.0);
let fut = async move {
<T as Probe>::test_stream(&inner, request).await
};
Box::pin(fut)
}
}
let accept_compression_encodings = self.accept_compression_encodings;
let send_compression_encodings = self.send_compression_encodings;
let max_decoding_message_size = self.max_decoding_message_size;
let max_encoding_message_size = self.max_encoding_message_size;
let inner = self.inner.clone();
let fut = async move {
let method = TestStreamSvc(inner);
let codec = tonic::codec::ProstCodec::default();
let mut grpc = tonic::server::Grpc::new(codec)
.apply_compression_config(
accept_compression_encodings,
send_compression_encodings,
)
.apply_max_message_size_config(
max_decoding_message_size,
max_encoding_message_size,
);
let res = grpc.streaming(method, req).await;
Ok(res)
};
Box::pin(fut)
}
"/bilibili.api.probe.v1.Probe/TestSub" => {
#[allow(non_camel_case_types)]
struct TestSubSvc<T: Probe>(pub Arc<T>);
impl<
T: Probe,
> tonic::server::ServerStreamingService<super::ProbeSubReq>
for TestSubSvc<T> {
type Response = super::ProbeSubReply;
type ResponseStream = T::TestSubStream;
type Future = BoxFuture<
tonic::Response<Self::ResponseStream>,
tonic::Status,
>;
fn call(
&mut self,
request: tonic::Request<super::ProbeSubReq>,
) -> Self::Future {
let inner = Arc::clone(&self.0);
let fut = async move {
<T as Probe>::test_sub(&inner, request).await
};
Box::pin(fut)
}
}
let accept_compression_encodings = self.accept_compression_encodings;
let send_compression_encodings = self.send_compression_encodings;
let max_decoding_message_size = self.max_decoding_message_size;
let max_encoding_message_size = self.max_encoding_message_size;
let inner = self.inner.clone();
let fut = async move {
let method = TestSubSvc(inner);
let codec = tonic::codec::ProstCodec::default();
let mut grpc = tonic::server::Grpc::new(codec)
.apply_compression_config(
accept_compression_encodings,
send_compression_encodings,
)
.apply_max_message_size_config(
max_decoding_message_size,
max_encoding_message_size,
);
let res = grpc.server_streaming(method, req).await;
Ok(res)
};
Box::pin(fut)
}
_ => {
Box::pin(async move {
let mut response = http::Response::new(
tonic::body::Body::default(),
);
let headers = response.headers_mut();
headers
.insert(
tonic::Status::GRPC_STATUS,
(tonic::Code::Unimplemented as i32).into(),
);
headers
.insert(
http::header::CONTENT_TYPE,
tonic::metadata::GRPC_CONTENT_TYPE,
);
Ok(response)
})
}
}
}
}
impl<T> Clone for ProbeServer<T> {
fn clone(&self) -> Self {
let inner = self.inner.clone();
Self {
inner,
accept_compression_encodings: self.accept_compression_encodings,
send_compression_encodings: self.send_compression_encodings,
max_decoding_message_size: self.max_decoding_message_size,
max_encoding_message_size: self.max_encoding_message_size,
}
}
}
pub const SERVICE_NAME: &str = "bilibili.api.probe.v1.Probe";
impl<T> tonic::server::NamedService for ProbeServer<T> {
const NAME: &'static str = SERVICE_NAME;
}
}
#[cfg(feature = "feat-enable-generated-server")]
pub mod probe_service_server {
#![allow(
unused_variables,
dead_code,
missing_docs,
clippy::wildcard_imports,
clippy::let_unit_value,
)]
use tonic::codegen::*;
#[async_trait]
pub trait ProbeService: std::marker::Send + std::marker::Sync + 'static {
async fn echo(
&self,
request: tonic::Request<super::SimpleMessage>,
) -> std::result::Result<tonic::Response<super::SimpleMessage>, tonic::Status>;
async fn echo_body(
&self,
request: tonic::Request<super::SimpleMessage>,
) -> std::result::Result<tonic::Response<super::SimpleMessage>, tonic::Status>;
async fn echo_delete(
&self,
request: tonic::Request<super::SimpleMessage>,
) -> std::result::Result<tonic::Response<super::SimpleMessage>, tonic::Status>;
async fn echo_error(
&self,
request: tonic::Request<super::ErrorMessage>,
) -> std::result::Result<tonic::Response<super::ErrorMessage>, tonic::Status>;
async fn echo_patch(
&self,
request: tonic::Request<super::DynamicMessageUpdate>,
) -> std::result::Result<
tonic::Response<super::DynamicMessageUpdate>,
tonic::Status,
>;
}
#[derive(Debug)]
pub struct ProbeServiceServer<T> {
inner: Arc<T>,
accept_compression_encodings: EnabledCompressionEncodings,
send_compression_encodings: EnabledCompressionEncodings,
max_decoding_message_size: Option<usize>,
max_encoding_message_size: Option<usize>,
}
impl<T> ProbeServiceServer<T> {
pub fn new(inner: T) -> Self {
Self::from_arc(Arc::new(inner))
}
pub fn from_arc(inner: Arc<T>) -> Self {
Self {
inner,
accept_compression_encodings: Default::default(),
send_compression_encodings: Default::default(),
max_decoding_message_size: None,
max_encoding_message_size: None,
}
}
pub fn with_interceptor<F>(
inner: T,
interceptor: F,
) -> InterceptedService<Self, F>
where
F: tonic::service::Interceptor,
{
InterceptedService::new(Self::new(inner), interceptor)
}
#[must_use]
pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
self.accept_compression_encodings.enable(encoding);
self
}
#[must_use]
pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
self.send_compression_encodings.enable(encoding);
self
}
#[must_use]
pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
self.max_decoding_message_size = Some(limit);
self
}
#[must_use]
pub fn max_encoding_message_size(mut self, limit: usize) -> Self {
self.max_encoding_message_size = Some(limit);
self
}
}
impl<T, B> tonic::codegen::Service<http::Request<B>> for ProbeServiceServer<T>
where
T: ProbeService,
B: Body + std::marker::Send + 'static,
B::Error: Into<StdError> + std::marker::Send + 'static,
{
type Response = http::Response<tonic::body::Body>;
type Error = std::convert::Infallible;
type Future = BoxFuture<Self::Response, Self::Error>;
fn poll_ready(
&mut self,
_cx: &mut Context<'_>,
) -> Poll<std::result::Result<(), Self::Error>> {
Poll::Ready(Ok(()))
}
fn call(&mut self, req: http::Request<B>) -> Self::Future {
match req.uri().path() {
"/bilibili.api.probe.v1.ProbeService/Echo" => {
#[allow(non_camel_case_types)]
struct EchoSvc<T: ProbeService>(pub Arc<T>);
impl<
T: ProbeService,
> tonic::server::UnaryService<super::SimpleMessage> for EchoSvc<T> {
type Response = super::SimpleMessage;
type Future = BoxFuture<
tonic::Response<Self::Response>,
tonic::Status,
>;
fn call(
&mut self,
request: tonic::Request<super::SimpleMessage>,
) -> Self::Future {
let inner = Arc::clone(&self.0);
let fut = async move {
<T as ProbeService>::echo(&inner, request).await
};
Box::pin(fut)
}
}
let accept_compression_encodings = self.accept_compression_encodings;
let send_compression_encodings = self.send_compression_encodings;
let max_decoding_message_size = self.max_decoding_message_size;
let max_encoding_message_size = self.max_encoding_message_size;
let inner = self.inner.clone();
let fut = async move {
let method = EchoSvc(inner);
let codec = tonic::codec::ProstCodec::default();
let mut grpc = tonic::server::Grpc::new(codec)
.apply_compression_config(
accept_compression_encodings,
send_compression_encodings,
)
.apply_max_message_size_config(
max_decoding_message_size,
max_encoding_message_size,
);
let res = grpc.unary(method, req).await;
Ok(res)
};
Box::pin(fut)
}
"/bilibili.api.probe.v1.ProbeService/EchoBody" => {
#[allow(non_camel_case_types)]
struct EchoBodySvc<T: ProbeService>(pub Arc<T>);
impl<
T: ProbeService,
> tonic::server::UnaryService<super::SimpleMessage>
for EchoBodySvc<T> {
type Response = super::SimpleMessage;
type Future = BoxFuture<
tonic::Response<Self::Response>,
tonic::Status,
>;
fn call(
&mut self,
request: tonic::Request<super::SimpleMessage>,
) -> Self::Future {
let inner = Arc::clone(&self.0);
let fut = async move {
<T as ProbeService>::echo_body(&inner, request).await
};
Box::pin(fut)
}
}
let accept_compression_encodings = self.accept_compression_encodings;
let send_compression_encodings = self.send_compression_encodings;
let max_decoding_message_size = self.max_decoding_message_size;
let max_encoding_message_size = self.max_encoding_message_size;
let inner = self.inner.clone();
let fut = async move {
let method = EchoBodySvc(inner);
let codec = tonic::codec::ProstCodec::default();
let mut grpc = tonic::server::Grpc::new(codec)
.apply_compression_config(
accept_compression_encodings,
send_compression_encodings,
)
.apply_max_message_size_config(
max_decoding_message_size,
max_encoding_message_size,
);
let res = grpc.unary(method, req).await;
Ok(res)
};
Box::pin(fut)
}
"/bilibili.api.probe.v1.ProbeService/EchoDelete" => {
#[allow(non_camel_case_types)]
struct EchoDeleteSvc<T: ProbeService>(pub Arc<T>);
impl<
T: ProbeService,
> tonic::server::UnaryService<super::SimpleMessage>
for EchoDeleteSvc<T> {
type Response = super::SimpleMessage;
type Future = BoxFuture<
tonic::Response<Self::Response>,
tonic::Status,
>;
fn call(
&mut self,
request: tonic::Request<super::SimpleMessage>,
) -> Self::Future {
let inner = Arc::clone(&self.0);
let fut = async move {
<T as ProbeService>::echo_delete(&inner, request).await
};
Box::pin(fut)
}
}
let accept_compression_encodings = self.accept_compression_encodings;
let send_compression_encodings = self.send_compression_encodings;
let max_decoding_message_size = self.max_decoding_message_size;
let max_encoding_message_size = self.max_encoding_message_size;
let inner = self.inner.clone();
let fut = async move {
let method = EchoDeleteSvc(inner);
let codec = tonic::codec::ProstCodec::default();
let mut grpc = tonic::server::Grpc::new(codec)
.apply_compression_config(
accept_compression_encodings,
send_compression_encodings,
)
.apply_max_message_size_config(
max_decoding_message_size,
max_encoding_message_size,
);
let res = grpc.unary(method, req).await;
Ok(res)
};
Box::pin(fut)
}
"/bilibili.api.probe.v1.ProbeService/EchoError" => {
#[allow(non_camel_case_types)]
struct EchoErrorSvc<T: ProbeService>(pub Arc<T>);
impl<
T: ProbeService,
> tonic::server::UnaryService<super::ErrorMessage>
for EchoErrorSvc<T> {
type Response = super::ErrorMessage;
type Future = BoxFuture<
tonic::Response<Self::Response>,
tonic::Status,
>;
fn call(
&mut self,
request: tonic::Request<super::ErrorMessage>,
) -> Self::Future {
let inner = Arc::clone(&self.0);
let fut = async move {
<T as ProbeService>::echo_error(&inner, request).await
};
Box::pin(fut)
}
}
let accept_compression_encodings = self.accept_compression_encodings;
let send_compression_encodings = self.send_compression_encodings;
let max_decoding_message_size = self.max_decoding_message_size;
let max_encoding_message_size = self.max_encoding_message_size;
let inner = self.inner.clone();
let fut = async move {
let method = EchoErrorSvc(inner);
let codec = tonic::codec::ProstCodec::default();
let mut grpc = tonic::server::Grpc::new(codec)
.apply_compression_config(
accept_compression_encodings,
send_compression_encodings,
)
.apply_max_message_size_config(
max_decoding_message_size,
max_encoding_message_size,
);
let res = grpc.unary(method, req).await;
Ok(res)
};
Box::pin(fut)
}
"/bilibili.api.probe.v1.ProbeService/EchoPatch" => {
#[allow(non_camel_case_types)]
struct EchoPatchSvc<T: ProbeService>(pub Arc<T>);
impl<
T: ProbeService,
> tonic::server::UnaryService<super::DynamicMessageUpdate>
for EchoPatchSvc<T> {
type Response = super::DynamicMessageUpdate;
type Future = BoxFuture<
tonic::Response<Self::Response>,
tonic::Status,
>;
fn call(
&mut self,
request: tonic::Request<super::DynamicMessageUpdate>,
) -> Self::Future {
let inner = Arc::clone(&self.0);
let fut = async move {
<T as ProbeService>::echo_patch(&inner, request).await
};
Box::pin(fut)
}
}
let accept_compression_encodings = self.accept_compression_encodings;
let send_compression_encodings = self.send_compression_encodings;
let max_decoding_message_size = self.max_decoding_message_size;
let max_encoding_message_size = self.max_encoding_message_size;
let inner = self.inner.clone();
let fut = async move {
let method = EchoPatchSvc(inner);
let codec = tonic::codec::ProstCodec::default();
let mut grpc = tonic::server::Grpc::new(codec)
.apply_compression_config(
accept_compression_encodings,
send_compression_encodings,
)
.apply_max_message_size_config(
max_decoding_message_size,
max_encoding_message_size,
);
let res = grpc.unary(method, req).await;
Ok(res)
};
Box::pin(fut)
}
_ => {
Box::pin(async move {
let mut response = http::Response::new(
tonic::body::Body::default(),
);
let headers = response.headers_mut();
headers
.insert(
tonic::Status::GRPC_STATUS,
(tonic::Code::Unimplemented as i32).into(),
);
headers
.insert(
http::header::CONTENT_TYPE,
tonic::metadata::GRPC_CONTENT_TYPE,
);
Ok(response)
})
}
}
}
}
impl<T> Clone for ProbeServiceServer<T> {
fn clone(&self) -> Self {
let inner = self.inner.clone();
Self {
inner,
accept_compression_encodings: self.accept_compression_encodings,
send_compression_encodings: self.send_compression_encodings,
max_decoding_message_size: self.max_decoding_message_size,
max_encoding_message_size: self.max_encoding_message_size,
}
}
}
pub const SERVICE_NAME: &str = "bilibili.api.probe.v1.ProbeService";
impl<T> tonic::server::NamedService for ProbeServiceServer<T> {
const NAME: &'static str = SERVICE_NAME;
}
}