#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct TogglePauseRequest {}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct TogglePauseResponse {
#[prost(uint32, tag = "1")]
pub status: u32,
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct SkipNextRequest {}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct SkipNextResponse {}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct PlayerTime {
#[prost(message, optional, tag = "1")]
pub position: ::core::option::Option<Duration>,
#[prost(message, optional, tag = "2")]
pub total_duration: ::core::option::Option<Duration>,
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct GetProgressRequest {}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct GetProgressResponse {
#[prost(message, optional, tag = "1")]
pub progress: ::core::option::Option<PlayerTime>,
#[prost(uint32, tag = "3")]
pub current_track_index: u32,
#[prost(uint32, tag = "4")]
pub status: u32,
#[prost(uint32, tag = "5")]
pub volume: u32,
#[prost(int32, tag = "6")]
pub speed: i32,
#[prost(bool, tag = "7")]
pub gapless: bool,
#[prost(bool, tag = "8")]
pub current_track_updated: bool,
#[prost(string, tag = "9")]
pub radio_title: ::prost::alloc::string::String,
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct VolumeUpRequest {}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct VolumeDownRequest {}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct VolumeReply {
#[prost(uint32, tag = "1")]
pub volume: u32,
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct CycleLoopRequest {}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct CycleLoopReply {}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct SpeedUpRequest {}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct SpeedDownRequest {}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct SpeedReply {
#[prost(int32, tag = "1")]
pub speed: i32,
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct ToggleGaplessRequest {}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct ToggleGaplessReply {
#[prost(bool, tag = "1")]
pub gapless: bool,
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct SeekForwardRequest {}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct SeekBackwardRequest {}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct ReloadConfigRequest {}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct ReloadPlaylistRequest {}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct EmptyReply {}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct PlaySelectedRequest {}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct SkipPreviousRequest {}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct Duration {
#[prost(uint64, tag = "1")]
pub secs: u64,
#[prost(uint32, tag = "2")]
pub nanos: u32,
}
pub mod music_player_client {
#![allow(unused_variables, dead_code, missing_docs, clippy::let_unit_value)]
use tonic::codegen::*;
use tonic::codegen::http::Uri;
#[derive(Debug, Clone)]
pub struct MusicPlayerClient<T> {
inner: tonic::client::Grpc<T>,
}
impl MusicPlayerClient<tonic::transport::Channel> {
pub async fn connect<D>(dst: D) -> Result<Self, tonic::transport::Error>
where
D: TryInto<tonic::transport::Endpoint>,
D::Error: Into<StdError>,
{
let conn = tonic::transport::Endpoint::new(dst)?.connect().await?;
Ok(Self::new(conn))
}
}
impl<T> MusicPlayerClient<T>
where
T: tonic::client::GrpcService<tonic::body::BoxBody>,
T::Error: Into<StdError>,
T::ResponseBody: Body<Data = Bytes> + Send + 'static,
<T::ResponseBody as Body>::Error: Into<StdError> + 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,
) -> MusicPlayerClient<InterceptedService<T, F>>
where
F: tonic::service::Interceptor,
T::ResponseBody: Default,
T: tonic::codegen::Service<
http::Request<tonic::body::BoxBody>,
Response = http::Response<
<T as tonic::client::GrpcService<tonic::body::BoxBody>>::ResponseBody,
>,
>,
<T as tonic::codegen::Service<
http::Request<tonic::body::BoxBody>,
>>::Error: Into<StdError> + Send + Sync,
{
MusicPlayerClient::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 toggle_pause(
&mut self,
request: impl tonic::IntoRequest<super::TogglePauseRequest>,
) -> std::result::Result<
tonic::Response<super::TogglePauseResponse>,
tonic::Status,
> {
self.inner
.ready()
.await
.map_err(|e| {
tonic::Status::new(
tonic::Code::Unknown,
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic::codec::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/player.MusicPlayer/TogglePause",
);
let mut req = request.into_request();
req.extensions_mut()
.insert(GrpcMethod::new("player.MusicPlayer", "TogglePause"));
self.inner.unary(req, path, codec).await
}
pub async fn skip_next(
&mut self,
request: impl tonic::IntoRequest<super::SkipNextRequest>,
) -> std::result::Result<
tonic::Response<super::SkipNextResponse>,
tonic::Status,
> {
self.inner
.ready()
.await
.map_err(|e| {
tonic::Status::new(
tonic::Code::Unknown,
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic::codec::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/player.MusicPlayer/SkipNext",
);
let mut req = request.into_request();
req.extensions_mut()
.insert(GrpcMethod::new("player.MusicPlayer", "SkipNext"));
self.inner.unary(req, path, codec).await
}
pub async fn get_progress(
&mut self,
request: impl tonic::IntoRequest<super::GetProgressRequest>,
) -> std::result::Result<
tonic::Response<super::GetProgressResponse>,
tonic::Status,
> {
self.inner
.ready()
.await
.map_err(|e| {
tonic::Status::new(
tonic::Code::Unknown,
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic::codec::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/player.MusicPlayer/GetProgress",
);
let mut req = request.into_request();
req.extensions_mut()
.insert(GrpcMethod::new("player.MusicPlayer", "GetProgress"));
self.inner.unary(req, path, codec).await
}
pub async fn volume_up(
&mut self,
request: impl tonic::IntoRequest<super::VolumeUpRequest>,
) -> std::result::Result<tonic::Response<super::VolumeReply>, tonic::Status> {
self.inner
.ready()
.await
.map_err(|e| {
tonic::Status::new(
tonic::Code::Unknown,
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic::codec::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/player.MusicPlayer/VolumeUp",
);
let mut req = request.into_request();
req.extensions_mut()
.insert(GrpcMethod::new("player.MusicPlayer", "VolumeUp"));
self.inner.unary(req, path, codec).await
}
pub async fn volume_down(
&mut self,
request: impl tonic::IntoRequest<super::VolumeDownRequest>,
) -> std::result::Result<tonic::Response<super::VolumeReply>, tonic::Status> {
self.inner
.ready()
.await
.map_err(|e| {
tonic::Status::new(
tonic::Code::Unknown,
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic::codec::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/player.MusicPlayer/VolumeDown",
);
let mut req = request.into_request();
req.extensions_mut()
.insert(GrpcMethod::new("player.MusicPlayer", "VolumeDown"));
self.inner.unary(req, path, codec).await
}
pub async fn cycle_loop(
&mut self,
request: impl tonic::IntoRequest<super::CycleLoopRequest>,
) -> std::result::Result<tonic::Response<super::CycleLoopReply>, tonic::Status> {
self.inner
.ready()
.await
.map_err(|e| {
tonic::Status::new(
tonic::Code::Unknown,
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic::codec::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/player.MusicPlayer/CycleLoop",
);
let mut req = request.into_request();
req.extensions_mut()
.insert(GrpcMethod::new("player.MusicPlayer", "CycleLoop"));
self.inner.unary(req, path, codec).await
}
pub async fn speed_up(
&mut self,
request: impl tonic::IntoRequest<super::SpeedUpRequest>,
) -> std::result::Result<tonic::Response<super::SpeedReply>, tonic::Status> {
self.inner
.ready()
.await
.map_err(|e| {
tonic::Status::new(
tonic::Code::Unknown,
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic::codec::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/player.MusicPlayer/SpeedUp",
);
let mut req = request.into_request();
req.extensions_mut()
.insert(GrpcMethod::new("player.MusicPlayer", "SpeedUp"));
self.inner.unary(req, path, codec).await
}
pub async fn speed_down(
&mut self,
request: impl tonic::IntoRequest<super::SpeedDownRequest>,
) -> std::result::Result<tonic::Response<super::SpeedReply>, tonic::Status> {
self.inner
.ready()
.await
.map_err(|e| {
tonic::Status::new(
tonic::Code::Unknown,
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic::codec::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/player.MusicPlayer/SpeedDown",
);
let mut req = request.into_request();
req.extensions_mut()
.insert(GrpcMethod::new("player.MusicPlayer", "SpeedDown"));
self.inner.unary(req, path, codec).await
}
pub async fn toggle_gapless(
&mut self,
request: impl tonic::IntoRequest<super::ToggleGaplessRequest>,
) -> std::result::Result<
tonic::Response<super::ToggleGaplessReply>,
tonic::Status,
> {
self.inner
.ready()
.await
.map_err(|e| {
tonic::Status::new(
tonic::Code::Unknown,
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic::codec::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/player.MusicPlayer/ToggleGapless",
);
let mut req = request.into_request();
req.extensions_mut()
.insert(GrpcMethod::new("player.MusicPlayer", "ToggleGapless"));
self.inner.unary(req, path, codec).await
}
pub async fn seek_forward(
&mut self,
request: impl tonic::IntoRequest<super::SeekForwardRequest>,
) -> std::result::Result<tonic::Response<super::PlayerTime>, tonic::Status> {
self.inner
.ready()
.await
.map_err(|e| {
tonic::Status::new(
tonic::Code::Unknown,
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic::codec::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/player.MusicPlayer/SeekForward",
);
let mut req = request.into_request();
req.extensions_mut()
.insert(GrpcMethod::new("player.MusicPlayer", "SeekForward"));
self.inner.unary(req, path, codec).await
}
pub async fn seek_backward(
&mut self,
request: impl tonic::IntoRequest<super::SeekBackwardRequest>,
) -> std::result::Result<tonic::Response<super::PlayerTime>, tonic::Status> {
self.inner
.ready()
.await
.map_err(|e| {
tonic::Status::new(
tonic::Code::Unknown,
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic::codec::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/player.MusicPlayer/SeekBackward",
);
let mut req = request.into_request();
req.extensions_mut()
.insert(GrpcMethod::new("player.MusicPlayer", "SeekBackward"));
self.inner.unary(req, path, codec).await
}
pub async fn reload_config(
&mut self,
request: impl tonic::IntoRequest<super::ReloadConfigRequest>,
) -> std::result::Result<tonic::Response<super::EmptyReply>, tonic::Status> {
self.inner
.ready()
.await
.map_err(|e| {
tonic::Status::new(
tonic::Code::Unknown,
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic::codec::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/player.MusicPlayer/ReloadConfig",
);
let mut req = request.into_request();
req.extensions_mut()
.insert(GrpcMethod::new("player.MusicPlayer", "ReloadConfig"));
self.inner.unary(req, path, codec).await
}
pub async fn reload_playlist(
&mut self,
request: impl tonic::IntoRequest<super::ReloadPlaylistRequest>,
) -> std::result::Result<tonic::Response<super::EmptyReply>, tonic::Status> {
self.inner
.ready()
.await
.map_err(|e| {
tonic::Status::new(
tonic::Code::Unknown,
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic::codec::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/player.MusicPlayer/ReloadPlaylist",
);
let mut req = request.into_request();
req.extensions_mut()
.insert(GrpcMethod::new("player.MusicPlayer", "ReloadPlaylist"));
self.inner.unary(req, path, codec).await
}
pub async fn play_selected(
&mut self,
request: impl tonic::IntoRequest<super::PlaySelectedRequest>,
) -> std::result::Result<tonic::Response<super::EmptyReply>, tonic::Status> {
self.inner
.ready()
.await
.map_err(|e| {
tonic::Status::new(
tonic::Code::Unknown,
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic::codec::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/player.MusicPlayer/PlaySelected",
);
let mut req = request.into_request();
req.extensions_mut()
.insert(GrpcMethod::new("player.MusicPlayer", "PlaySelected"));
self.inner.unary(req, path, codec).await
}
pub async fn skip_previous(
&mut self,
request: impl tonic::IntoRequest<super::SkipPreviousRequest>,
) -> std::result::Result<tonic::Response<super::EmptyReply>, tonic::Status> {
self.inner
.ready()
.await
.map_err(|e| {
tonic::Status::new(
tonic::Code::Unknown,
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic::codec::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/player.MusicPlayer/SkipPrevious",
);
let mut req = request.into_request();
req.extensions_mut()
.insert(GrpcMethod::new("player.MusicPlayer", "SkipPrevious"));
self.inner.unary(req, path, codec).await
}
}
}
pub mod music_player_server {
#![allow(unused_variables, dead_code, missing_docs, clippy::let_unit_value)]
use tonic::codegen::*;
#[async_trait]
pub trait MusicPlayer: Send + Sync + 'static {
async fn toggle_pause(
&self,
request: tonic::Request<super::TogglePauseRequest>,
) -> std::result::Result<
tonic::Response<super::TogglePauseResponse>,
tonic::Status,
>;
async fn skip_next(
&self,
request: tonic::Request<super::SkipNextRequest>,
) -> std::result::Result<
tonic::Response<super::SkipNextResponse>,
tonic::Status,
>;
async fn get_progress(
&self,
request: tonic::Request<super::GetProgressRequest>,
) -> std::result::Result<
tonic::Response<super::GetProgressResponse>,
tonic::Status,
>;
async fn volume_up(
&self,
request: tonic::Request<super::VolumeUpRequest>,
) -> std::result::Result<tonic::Response<super::VolumeReply>, tonic::Status>;
async fn volume_down(
&self,
request: tonic::Request<super::VolumeDownRequest>,
) -> std::result::Result<tonic::Response<super::VolumeReply>, tonic::Status>;
async fn cycle_loop(
&self,
request: tonic::Request<super::CycleLoopRequest>,
) -> std::result::Result<tonic::Response<super::CycleLoopReply>, tonic::Status>;
async fn speed_up(
&self,
request: tonic::Request<super::SpeedUpRequest>,
) -> std::result::Result<tonic::Response<super::SpeedReply>, tonic::Status>;
async fn speed_down(
&self,
request: tonic::Request<super::SpeedDownRequest>,
) -> std::result::Result<tonic::Response<super::SpeedReply>, tonic::Status>;
async fn toggle_gapless(
&self,
request: tonic::Request<super::ToggleGaplessRequest>,
) -> std::result::Result<
tonic::Response<super::ToggleGaplessReply>,
tonic::Status,
>;
async fn seek_forward(
&self,
request: tonic::Request<super::SeekForwardRequest>,
) -> std::result::Result<tonic::Response<super::PlayerTime>, tonic::Status>;
async fn seek_backward(
&self,
request: tonic::Request<super::SeekBackwardRequest>,
) -> std::result::Result<tonic::Response<super::PlayerTime>, tonic::Status>;
async fn reload_config(
&self,
request: tonic::Request<super::ReloadConfigRequest>,
) -> std::result::Result<tonic::Response<super::EmptyReply>, tonic::Status>;
async fn reload_playlist(
&self,
request: tonic::Request<super::ReloadPlaylistRequest>,
) -> std::result::Result<tonic::Response<super::EmptyReply>, tonic::Status>;
async fn play_selected(
&self,
request: tonic::Request<super::PlaySelectedRequest>,
) -> std::result::Result<tonic::Response<super::EmptyReply>, tonic::Status>;
async fn skip_previous(
&self,
request: tonic::Request<super::SkipPreviousRequest>,
) -> std::result::Result<tonic::Response<super::EmptyReply>, tonic::Status>;
}
#[derive(Debug)]
pub struct MusicPlayerServer<T: MusicPlayer> {
inner: _Inner<T>,
accept_compression_encodings: EnabledCompressionEncodings,
send_compression_encodings: EnabledCompressionEncodings,
max_decoding_message_size: Option<usize>,
max_encoding_message_size: Option<usize>,
}
struct _Inner<T>(Arc<T>);
impl<T: MusicPlayer> MusicPlayerServer<T> {
pub fn new(inner: T) -> Self {
Self::from_arc(Arc::new(inner))
}
pub fn from_arc(inner: Arc<T>) -> Self {
let inner = _Inner(inner);
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 MusicPlayerServer<T>
where
T: MusicPlayer,
B: Body + Send + 'static,
B::Error: Into<StdError> + Send + 'static,
{
type Response = http::Response<tonic::body::BoxBody>;
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 {
let inner = self.inner.clone();
match req.uri().path() {
"/player.MusicPlayer/TogglePause" => {
#[allow(non_camel_case_types)]
struct TogglePauseSvc<T: MusicPlayer>(pub Arc<T>);
impl<
T: MusicPlayer,
> tonic::server::UnaryService<super::TogglePauseRequest>
for TogglePauseSvc<T> {
type Response = super::TogglePauseResponse;
type Future = BoxFuture<
tonic::Response<Self::Response>,
tonic::Status,
>;
fn call(
&mut self,
request: tonic::Request<super::TogglePauseRequest>,
) -> Self::Future {
let inner = Arc::clone(&self.0);
let fut = async move {
<T as MusicPlayer>::toggle_pause(&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 inner = inner.0;
let method = TogglePauseSvc(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)
}
"/player.MusicPlayer/SkipNext" => {
#[allow(non_camel_case_types)]
struct SkipNextSvc<T: MusicPlayer>(pub Arc<T>);
impl<
T: MusicPlayer,
> tonic::server::UnaryService<super::SkipNextRequest>
for SkipNextSvc<T> {
type Response = super::SkipNextResponse;
type Future = BoxFuture<
tonic::Response<Self::Response>,
tonic::Status,
>;
fn call(
&mut self,
request: tonic::Request<super::SkipNextRequest>,
) -> Self::Future {
let inner = Arc::clone(&self.0);
let fut = async move {
<T as MusicPlayer>::skip_next(&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 inner = inner.0;
let method = SkipNextSvc(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)
}
"/player.MusicPlayer/GetProgress" => {
#[allow(non_camel_case_types)]
struct GetProgressSvc<T: MusicPlayer>(pub Arc<T>);
impl<
T: MusicPlayer,
> tonic::server::UnaryService<super::GetProgressRequest>
for GetProgressSvc<T> {
type Response = super::GetProgressResponse;
type Future = BoxFuture<
tonic::Response<Self::Response>,
tonic::Status,
>;
fn call(
&mut self,
request: tonic::Request<super::GetProgressRequest>,
) -> Self::Future {
let inner = Arc::clone(&self.0);
let fut = async move {
<T as MusicPlayer>::get_progress(&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 inner = inner.0;
let method = GetProgressSvc(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)
}
"/player.MusicPlayer/VolumeUp" => {
#[allow(non_camel_case_types)]
struct VolumeUpSvc<T: MusicPlayer>(pub Arc<T>);
impl<
T: MusicPlayer,
> tonic::server::UnaryService<super::VolumeUpRequest>
for VolumeUpSvc<T> {
type Response = super::VolumeReply;
type Future = BoxFuture<
tonic::Response<Self::Response>,
tonic::Status,
>;
fn call(
&mut self,
request: tonic::Request<super::VolumeUpRequest>,
) -> Self::Future {
let inner = Arc::clone(&self.0);
let fut = async move {
<T as MusicPlayer>::volume_up(&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 inner = inner.0;
let method = VolumeUpSvc(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)
}
"/player.MusicPlayer/VolumeDown" => {
#[allow(non_camel_case_types)]
struct VolumeDownSvc<T: MusicPlayer>(pub Arc<T>);
impl<
T: MusicPlayer,
> tonic::server::UnaryService<super::VolumeDownRequest>
for VolumeDownSvc<T> {
type Response = super::VolumeReply;
type Future = BoxFuture<
tonic::Response<Self::Response>,
tonic::Status,
>;
fn call(
&mut self,
request: tonic::Request<super::VolumeDownRequest>,
) -> Self::Future {
let inner = Arc::clone(&self.0);
let fut = async move {
<T as MusicPlayer>::volume_down(&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 inner = inner.0;
let method = VolumeDownSvc(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)
}
"/player.MusicPlayer/CycleLoop" => {
#[allow(non_camel_case_types)]
struct CycleLoopSvc<T: MusicPlayer>(pub Arc<T>);
impl<
T: MusicPlayer,
> tonic::server::UnaryService<super::CycleLoopRequest>
for CycleLoopSvc<T> {
type Response = super::CycleLoopReply;
type Future = BoxFuture<
tonic::Response<Self::Response>,
tonic::Status,
>;
fn call(
&mut self,
request: tonic::Request<super::CycleLoopRequest>,
) -> Self::Future {
let inner = Arc::clone(&self.0);
let fut = async move {
<T as MusicPlayer>::cycle_loop(&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 inner = inner.0;
let method = CycleLoopSvc(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)
}
"/player.MusicPlayer/SpeedUp" => {
#[allow(non_camel_case_types)]
struct SpeedUpSvc<T: MusicPlayer>(pub Arc<T>);
impl<
T: MusicPlayer,
> tonic::server::UnaryService<super::SpeedUpRequest>
for SpeedUpSvc<T> {
type Response = super::SpeedReply;
type Future = BoxFuture<
tonic::Response<Self::Response>,
tonic::Status,
>;
fn call(
&mut self,
request: tonic::Request<super::SpeedUpRequest>,
) -> Self::Future {
let inner = Arc::clone(&self.0);
let fut = async move {
<T as MusicPlayer>::speed_up(&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 inner = inner.0;
let method = SpeedUpSvc(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)
}
"/player.MusicPlayer/SpeedDown" => {
#[allow(non_camel_case_types)]
struct SpeedDownSvc<T: MusicPlayer>(pub Arc<T>);
impl<
T: MusicPlayer,
> tonic::server::UnaryService<super::SpeedDownRequest>
for SpeedDownSvc<T> {
type Response = super::SpeedReply;
type Future = BoxFuture<
tonic::Response<Self::Response>,
tonic::Status,
>;
fn call(
&mut self,
request: tonic::Request<super::SpeedDownRequest>,
) -> Self::Future {
let inner = Arc::clone(&self.0);
let fut = async move {
<T as MusicPlayer>::speed_down(&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 inner = inner.0;
let method = SpeedDownSvc(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)
}
"/player.MusicPlayer/ToggleGapless" => {
#[allow(non_camel_case_types)]
struct ToggleGaplessSvc<T: MusicPlayer>(pub Arc<T>);
impl<
T: MusicPlayer,
> tonic::server::UnaryService<super::ToggleGaplessRequest>
for ToggleGaplessSvc<T> {
type Response = super::ToggleGaplessReply;
type Future = BoxFuture<
tonic::Response<Self::Response>,
tonic::Status,
>;
fn call(
&mut self,
request: tonic::Request<super::ToggleGaplessRequest>,
) -> Self::Future {
let inner = Arc::clone(&self.0);
let fut = async move {
<T as MusicPlayer>::toggle_gapless(&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 inner = inner.0;
let method = ToggleGaplessSvc(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)
}
"/player.MusicPlayer/SeekForward" => {
#[allow(non_camel_case_types)]
struct SeekForwardSvc<T: MusicPlayer>(pub Arc<T>);
impl<
T: MusicPlayer,
> tonic::server::UnaryService<super::SeekForwardRequest>
for SeekForwardSvc<T> {
type Response = super::PlayerTime;
type Future = BoxFuture<
tonic::Response<Self::Response>,
tonic::Status,
>;
fn call(
&mut self,
request: tonic::Request<super::SeekForwardRequest>,
) -> Self::Future {
let inner = Arc::clone(&self.0);
let fut = async move {
<T as MusicPlayer>::seek_forward(&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 inner = inner.0;
let method = SeekForwardSvc(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)
}
"/player.MusicPlayer/SeekBackward" => {
#[allow(non_camel_case_types)]
struct SeekBackwardSvc<T: MusicPlayer>(pub Arc<T>);
impl<
T: MusicPlayer,
> tonic::server::UnaryService<super::SeekBackwardRequest>
for SeekBackwardSvc<T> {
type Response = super::PlayerTime;
type Future = BoxFuture<
tonic::Response<Self::Response>,
tonic::Status,
>;
fn call(
&mut self,
request: tonic::Request<super::SeekBackwardRequest>,
) -> Self::Future {
let inner = Arc::clone(&self.0);
let fut = async move {
<T as MusicPlayer>::seek_backward(&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 inner = inner.0;
let method = SeekBackwardSvc(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)
}
"/player.MusicPlayer/ReloadConfig" => {
#[allow(non_camel_case_types)]
struct ReloadConfigSvc<T: MusicPlayer>(pub Arc<T>);
impl<
T: MusicPlayer,
> tonic::server::UnaryService<super::ReloadConfigRequest>
for ReloadConfigSvc<T> {
type Response = super::EmptyReply;
type Future = BoxFuture<
tonic::Response<Self::Response>,
tonic::Status,
>;
fn call(
&mut self,
request: tonic::Request<super::ReloadConfigRequest>,
) -> Self::Future {
let inner = Arc::clone(&self.0);
let fut = async move {
<T as MusicPlayer>::reload_config(&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 inner = inner.0;
let method = ReloadConfigSvc(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)
}
"/player.MusicPlayer/ReloadPlaylist" => {
#[allow(non_camel_case_types)]
struct ReloadPlaylistSvc<T: MusicPlayer>(pub Arc<T>);
impl<
T: MusicPlayer,
> tonic::server::UnaryService<super::ReloadPlaylistRequest>
for ReloadPlaylistSvc<T> {
type Response = super::EmptyReply;
type Future = BoxFuture<
tonic::Response<Self::Response>,
tonic::Status,
>;
fn call(
&mut self,
request: tonic::Request<super::ReloadPlaylistRequest>,
) -> Self::Future {
let inner = Arc::clone(&self.0);
let fut = async move {
<T as MusicPlayer>::reload_playlist(&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 inner = inner.0;
let method = ReloadPlaylistSvc(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)
}
"/player.MusicPlayer/PlaySelected" => {
#[allow(non_camel_case_types)]
struct PlaySelectedSvc<T: MusicPlayer>(pub Arc<T>);
impl<
T: MusicPlayer,
> tonic::server::UnaryService<super::PlaySelectedRequest>
for PlaySelectedSvc<T> {
type Response = super::EmptyReply;
type Future = BoxFuture<
tonic::Response<Self::Response>,
tonic::Status,
>;
fn call(
&mut self,
request: tonic::Request<super::PlaySelectedRequest>,
) -> Self::Future {
let inner = Arc::clone(&self.0);
let fut = async move {
<T as MusicPlayer>::play_selected(&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 inner = inner.0;
let method = PlaySelectedSvc(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)
}
"/player.MusicPlayer/SkipPrevious" => {
#[allow(non_camel_case_types)]
struct SkipPreviousSvc<T: MusicPlayer>(pub Arc<T>);
impl<
T: MusicPlayer,
> tonic::server::UnaryService<super::SkipPreviousRequest>
for SkipPreviousSvc<T> {
type Response = super::EmptyReply;
type Future = BoxFuture<
tonic::Response<Self::Response>,
tonic::Status,
>;
fn call(
&mut self,
request: tonic::Request<super::SkipPreviousRequest>,
) -> Self::Future {
let inner = Arc::clone(&self.0);
let fut = async move {
<T as MusicPlayer>::skip_previous(&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 inner = inner.0;
let method = SkipPreviousSvc(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 {
Ok(
http::Response::builder()
.status(200)
.header("grpc-status", "12")
.header("content-type", "application/grpc")
.body(empty_body())
.unwrap(),
)
})
}
}
}
}
impl<T: MusicPlayer> Clone for MusicPlayerServer<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,
}
}
}
impl<T: MusicPlayer> Clone for _Inner<T> {
fn clone(&self) -> Self {
Self(Arc::clone(&self.0))
}
}
impl<T: std::fmt::Debug> std::fmt::Debug for _Inner<T> {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
write!(f, "{:?}", self.0)
}
}
impl<T: MusicPlayer> tonic::server::NamedService for MusicPlayerServer<T> {
const NAME: &'static str = "player.MusicPlayer";
}
}