blob: 8a618c1f6ea830b9556428237bfece60d11995d9 [file] [log] [blame]
// DO NOT EDIT: This file is machine-generated by fidlgen
#![warn(clippy::all)]
#![allow(unused_parens, unused_variables, unused_mut, unused_imports, unreachable_code)]
/// The type corresponding to the DriverOnlyService service.
#[derive(Debug)]
pub struct DriverOnlyService;
impl ::fidl_next::DiscoverableService for DriverOnlyService {
const SERVICE_NAME: &'static str = "test.driverservice.DriverOnlyService";
const MEMBER_NAMES: &'static [&'static str] = &["member"];
}
impl<___C> ::fidl_next::Service<___C> for DriverOnlyService
where
___C: ::fidl_next::protocol::ServiceConnector<::fdf_fidl::DriverChannel>,
{
type Connector = DriverOnlyServiceConnector<___C>;
}
/// A strongly-typed service connector for the `DriverOnlyService` service.
#[repr(transparent)]
pub struct DriverOnlyServiceConnector<___C> {
#[allow(dead_code)]
connector: ___C,
}
impl<___C> DriverOnlyServiceConnector<___C>
where
___C: ::fidl_next::protocol::ServiceConnector<::fdf_fidl::DriverChannel>,
{
/// Attempts to connect to the `member` service member.
pub fn member(
&self,
server_end: ::fidl_next::ServerEnd<crate::SomeDriverProtocol, ::fdf_fidl::DriverChannel>,
) -> ::core::result::Result<
(),
<___C as ::fidl_next::protocol::ServiceConnector<::fdf_fidl::DriverChannel>>::Error,
> {
::fidl_next::protocol::ServiceConnector::<::fdf_fidl::DriverChannel>::connect_to_member(
&self.connector,
"member",
server_end.into_untyped(),
)
}
}
/// A service handler for the `DriverOnlyService` service.
pub trait DriverOnlyServiceHandler<___T> {
/// Handles an attempt to connect to the `member` member.
fn member(&self, server_end: ::fidl_next::ServerEnd<crate::SomeDriverProtocol, ___T>);
}
impl<___H, ___T> ::fidl_next::DispatchServiceHandler<___H, ___T> for DriverOnlyService
where
___H: DriverOnlyServiceHandler<___T>,
{
fn on_connection(handler: &___H, member: &str, server_end: ___T) {
match member {
"member" => handler.member(::fidl_next::ServerEnd::from_untyped(server_end)),
_ => unreachable!(),
}
}
}
/// The type corresponding to the SomeDriverProtocol protocol.
#[derive(PartialEq, Debug)]
pub struct SomeDriverProtocol;
pub mod some_driver_protocol {
pub mod prelude {
pub use crate::{
SomeDriverProtocol, SomeDriverProtocolClientHandler, SomeDriverProtocolServerHandler,
some_driver_protocol,
};
}
mod ___detail {
unsafe impl<___T> ::fidl_next::Protocol<___T> for crate::SomeDriverProtocol
where
___T: ::fidl_next::Transport,
{
type Client = SomeDriverProtocolClient<___T>;
type Server = SomeDriverProtocolServer<___T>;
}
/// The client for the `SomeDriverProtocol` protocol.
#[repr(transparent)]
pub struct SomeDriverProtocolClient<___T: ::fidl_next::Transport> {
#[allow(dead_code)]
client: ::fidl_next::protocol::Client<___T>,
}
impl<___T> SomeDriverProtocolClient<___T> where ___T: ::fidl_next::Transport {}
/// The server for the `SomeDriverProtocol` protocol.
#[repr(transparent)]
pub struct SomeDriverProtocolServer<___T: ::fidl_next::Transport> {
server: ::fidl_next::protocol::Server<___T>,
}
impl<___T> SomeDriverProtocolServer<___T> where ___T: ::fidl_next::Transport {}
}
}
/// A client handler for the SomeDriverProtocol protocol.
///
/// See [`SomeDriverProtocol`] for more details.
pub trait SomeDriverProtocolClientHandler<
#[cfg(not(feature = "fuchsia"))] ___T: ::fidl_next::Transport,
#[cfg(feature = "fuchsia")] ___T: ::fidl_next::Transport = ::fidl_next::fuchsia::zx::Channel,
>
{
}
impl<___H, ___T> ::fidl_next::DispatchClientMessage<___H, ___T> for SomeDriverProtocol
where
___H: SomeDriverProtocolClientHandler<___T> + ::core::marker::Send,
___T: ::fidl_next::Transport,
{
async fn on_event(
handler: &mut ___H,
client: &::fidl_next::Client<Self, ___T>,
ordinal: u64,
buffer: ___T::RecvBuffer,
) {
match ordinal {
ordinal => client.close(),
}
}
}
/// A server handler for the SomeDriverProtocol protocol.
///
/// See [`SomeDriverProtocol`] for more details.
pub trait SomeDriverProtocolServerHandler<
#[cfg(not(feature = "fuchsia"))] ___T: ::fidl_next::Transport,
#[cfg(feature = "fuchsia")] ___T: ::fidl_next::Transport = ::fidl_next::fuchsia::zx::Channel,
>
{
}
impl<___H, ___T> ::fidl_next::DispatchServerMessage<___H, ___T> for SomeDriverProtocol
where
___H: SomeDriverProtocolServerHandler<___T> + ::core::marker::Send,
___T: ::fidl_next::Transport,
{
async fn on_one_way(
handler: &mut ___H,
server: &::fidl_next::Server<Self, ___T>,
ordinal: u64,
buffer: ___T::RecvBuffer,
) {
match ordinal {
ordinal => server.close(),
}
}
async fn on_two_way(
handler: &mut ___H,
ordinal: u64,
buffer: ___T::RecvBuffer,
responder: ::fidl_next::protocol::Responder<___T>,
) {
match ordinal {
ordinal => responder.server().close(),
}
}
}
/// Compatibility shims which mimic some API surfaces of the current Rust bindings.
pub mod compat {
#[cfg(target_os = "fuchsia")]
/// An alias for a client over `zx::Channel` for the `SomeDriverProtocol`
/// protocol.
pub type SomeDriverProtocolProxy = ::fidl_next::Client<crate::SomeDriverProtocol>;
#[cfg(feature = "driver")]
impl ::fidl_next::CompatFrom<crate::SomeDriverProtocol>
for ::fidl_test_driverservice::SomeDriverProtocolMarker
{
fn compat_from(_: crate::SomeDriverProtocol) -> Self {
Self
}
}
#[cfg(feature = "driver")]
impl ::fidl_next::CompatFrom<::fidl_test_driverservice::SomeDriverProtocolMarker>
for crate::SomeDriverProtocol
{
fn compat_from(_: ::fidl_test_driverservice::SomeDriverProtocolMarker) -> Self {
Self
}
}
}