components/
process_printer.rs

1// Licensed under the Apache License, Version 2.0 or the MIT License.
2// SPDX-License-Identifier: Apache-2.0 OR MIT
3// Copyright Tock Contributors 2022.
4
5//! Component for process printers.
6//!
7//! Usage
8//! -----
9//! ```rust
10//! let process_printer = ProcessPrinterTextComponent::new()
11//!     .finalize(components::process_printer_component_static!());
12//! ```
13
14use core::mem::MaybeUninit;
15use kernel::component::Component;
16
17#[macro_export]
18macro_rules! process_printer_text_component_static {
19    () => {{
20        kernel::static_buf!(capsules_system::process_printer::ProcessPrinterText)
21    };};
22}
23
24pub struct ProcessPrinterTextComponent {}
25
26impl ProcessPrinterTextComponent {
27    pub fn new() -> ProcessPrinterTextComponent {
28        ProcessPrinterTextComponent {}
29    }
30}
31
32impl Component for ProcessPrinterTextComponent {
33    type StaticInput =
34        &'static mut MaybeUninit<capsules_system::process_printer::ProcessPrinterText>;
35    type Output = &'static capsules_system::process_printer::ProcessPrinterText;
36
37    fn finalize(self, static_buffer: Self::StaticInput) -> Self::Output {
38        static_buffer.write(capsules_system::process_printer::ProcessPrinterText::new())
39    }
40}