Skip to main content

device_envoy_esp/ir/
ir_generated.rs

1// @generated by `cargo check-all`. Do not edit by hand.
2//! Module containing sample struct types generated by IR macros:
3//! [`IrGenerated`], [`IrMappingGenerated`], and [`IrKeplerGenerated`].
4//!
5//! Auto-generated.
6
7#[cfg(doc)]
8use crate::Result;
9#[cfg(doc)]
10use crate::ir::{Ir, IrEvent, IrKepler, IrMapping, KeplerKeys};
11
12#[cfg(doc)]
13/// Sample struct type generated by the [`ir!`](macro@crate::ir) macro.
14///
15/// This page exists to show constructor and trait methods in one place. For
16/// narrative examples, see the [`ir`](mod@crate::ir) module.
17///
18/// Auto-generated.
19pub struct IrGenerated;
20
21#[cfg(doc)]
22impl IrGenerated {
23    /// Create a new IR receiver instance of the struct type defined by
24    /// [`ir!`](macro@crate::ir).
25    ///
26    /// See the [`ir`](mod@crate::ir) module docs for usage examples.
27    pub fn new(
28        pin: impl Sized,
29        channel_creator: impl Sized,
30        spawner: embassy_executor::Spawner,
31    ) -> Result<&'static Self> {
32        static INSTANCE: IrGenerated = IrGenerated;
33        let _ = (pin, channel_creator, spawner);
34        Ok(&INSTANCE)
35    }
36}
37
38#[cfg(doc)]
39impl Ir for IrGenerated {
40    async fn wait_for_press(&self) -> IrEvent {
41        core::future::pending().await
42    }
43}
44
45#[cfg(doc)]
46#[derive(Clone, Copy, Debug, PartialEq, Eq)]
47/// Sample key enum used by [`IrMappingGenerated`].
48pub enum RemoteKeysGenerated {
49    /// Power key.
50    Power,
51    /// Play key.
52    Play,
53    /// Stop key.
54    Stop,
55}
56
57#[cfg(doc)]
58/// Sample struct type generated by the [`ir_mapping!`](macro@crate::ir_mapping) macro.
59///
60/// This page exists to show constructor and trait methods in one place. For
61/// narrative examples, see the [`ir`](mod@crate::ir) module.
62///
63/// Auto-generated.
64pub struct IrMappingGenerated;
65
66#[cfg(doc)]
67impl IrMappingGenerated {
68    /// Create a new IR mapping instance of the struct type defined by
69    /// [`ir_mapping!`](macro@crate::ir_mapping).
70    ///
71    /// See the [`ir`](mod@crate::ir) module docs for usage examples.
72    pub fn new(
73        pin: impl Sized,
74        channel_creator: impl Sized,
75        button_map: &[(u16, u8, RemoteKeysGenerated)],
76        spawner: embassy_executor::Spawner,
77    ) -> Result<&'static Self> {
78        static INSTANCE: IrMappingGenerated = IrMappingGenerated;
79        let _ = (pin, channel_creator, button_map, spawner);
80        Ok(&INSTANCE)
81    }
82}
83
84#[cfg(doc)]
85impl IrMapping<RemoteKeysGenerated> for IrMappingGenerated {
86    async fn wait_for_press(&self) -> RemoteKeysGenerated {
87        core::future::pending().await
88    }
89}
90
91#[cfg(doc)]
92/// Sample struct type generated by the [`ir_kepler!`](macro@crate::ir_kepler) macro.
93///
94/// This page exists to show constructor and trait methods in one place. For
95/// narrative examples, see the [`ir`](mod@crate::ir) module.
96///
97/// Auto-generated.
98pub struct IrKeplerGenerated;
99
100#[cfg(doc)]
101impl IrKeplerGenerated {
102    /// Create a new Kepler IR instance of the struct type defined by
103    /// [`ir_kepler!`](macro@crate::ir_kepler).
104    ///
105    /// See the [`ir`](mod@crate::ir) module docs for usage examples.
106    pub fn new(
107        pin: impl Sized,
108        channel_creator: impl Sized,
109        spawner: embassy_executor::Spawner,
110    ) -> Result<&'static Self> {
111        static INSTANCE: IrKeplerGenerated = IrKeplerGenerated;
112        let _ = (pin, channel_creator, spawner);
113        Ok(&INSTANCE)
114    }
115}
116
117#[cfg(doc)]
118impl IrKepler for IrKeplerGenerated {
119    async fn wait_for_press(&self) -> KeplerKeys {
120        core::future::pending().await
121    }
122}