mirror of
https://codeberg.org/unspeaker/tengri.git
synced 2025-12-09 13:16:47 +01:00
tabula rasa
This commit is contained in:
commit
47b3413d7d
76 changed files with 7000 additions and 0 deletions
32
input/src/lib.rs
Normal file
32
input/src/lib.rs
Normal file
|
|
@ -0,0 +1,32 @@
|
|||
#![feature(associated_type_defaults)]
|
||||
mod input; pub use self::input::*;
|
||||
mod command; pub use self::command::*;
|
||||
mod keymap; pub use self::keymap::*;
|
||||
//mod event_map; pub use self::event_map::*;
|
||||
pub(crate) use ::tek_edn::*;
|
||||
/// Standard error trait.
|
||||
pub(crate) use std::error::Error;
|
||||
/// Standard result type.
|
||||
#[cfg(test)] pub(crate) type Usually<T> = Result<T, Box<dyn Error>>;
|
||||
/// Standard optional result type.
|
||||
pub(crate) type Perhaps<T> = Result<Option<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(())
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue