rdif_base/
lib.rs

1#![cfg_attr(not(test), no_std)]
2
3extern crate alloc;
4
5pub use core::any::Any;
6
7#[macro_use]
8mod _macros;
9pub use paste::paste;
10pub use rdif_def::{CpuId, KError, custom_type, irq};
11pub mod io;
12
13pub mod _rdif_prelude {
14    pub use super::{CpuId, DriverGeneric, KError, io, irq::*};
15}
16
17pub trait DriverGeneric: Send + Any {
18    fn open(&mut self) -> Result<(), KError>;
19    fn close(&mut self) -> Result<(), KError>;
20
21    /// Subtype casting support, returns subtype as `&dyn Any`
22    fn raw_any(&self) -> Option<&dyn Any> {
23        None
24    }
25    /// Subtype casting support, returns subtype as `&mut dyn Any`
26    fn raw_any_mut(&mut self) -> Option<&mut dyn Any> {
27        None
28    }
29}