mirror of
https://codeberg.org/unspeaker/tengri.git
synced 2025-12-06 11:46:42 +01:00
38 lines
1,007 B
Rust
38 lines
1,007 B
Rust
#![feature(associated_type_defaults)]
|
|
mod command; pub use self::command::*;
|
|
mod handle; pub use self::handle::*;
|
|
mod keymap; pub use self::keymap::*;
|
|
|
|
#[cfg(feature = "dsl")] pub(crate) use ::tengri_dsl::*;
|
|
|
|
/// Standard error trait.
|
|
pub(crate) use std::error::Error;
|
|
|
|
/// Standard optional result type.
|
|
pub(crate) type Perhaps<T> = Result<Option<T>, Box<dyn Error>>;
|
|
|
|
/// Standard result type.
|
|
#[cfg(test)]
|
|
pub(crate) type Usually<T> = Result<T, Box<dyn Error>>;
|
|
|
|
#[cfg(test)]
|
|
#[test] fn test_stub_input () -> Usually<()> {
|
|
use crate::*;
|
|
struct TestInput(bool);
|
|
enum TestEvent { Test1 }
|
|
impl Input for TestInput {
|
|
type Event = TestEvent;
|
|
type Handled = ();
|
|
fn event (&self) -> &Self::Event {
|
|
&TestEvent::Test1
|
|
}
|
|
fn is_done (&self) -> bool {
|
|
self.0
|
|
}
|
|
fn done (&self) {}
|
|
}
|
|
let _ = TestInput(true).event();
|
|
assert!(TestInput(true).is_done());
|
|
assert!(!TestInput(false).is_done());
|
|
Ok(())
|
|
}
|