mirror of
https://codeberg.org/unspeaker/tengri.git
synced 2025-12-07 12:16:44 +01:00
tabula rasa
This commit is contained in:
commit
47b3413d7d
76 changed files with 7000 additions and 0 deletions
55
output/src/lib.rs
Normal file
55
output/src/lib.rs
Normal file
|
|
@ -0,0 +1,55 @@
|
|||
//#![feature(lazy_type_alias)]
|
||||
#![feature(step_trait)]
|
||||
#![feature(type_alias_impl_trait)]
|
||||
#![feature(impl_trait_in_assoc_type)]
|
||||
mod direction; pub use self::direction::*;
|
||||
mod coordinate; pub use self::coordinate::*;
|
||||
mod size; pub use self::size::*;
|
||||
mod area; pub use self::area::*;
|
||||
mod output; pub use self::output::*;
|
||||
mod measure; pub use self::measure::*;
|
||||
mod thunk; pub use self::thunk::*;
|
||||
mod op_cond; pub use self::op_cond::*;
|
||||
mod op_iter; pub use self::op_iter::*;
|
||||
mod op_align; pub use self::op_align::*;
|
||||
mod op_bsp; pub use self::op_bsp::*;
|
||||
mod op_transform; pub use self::op_transform::*;
|
||||
mod view; pub use self::view::*;
|
||||
pub(crate) use std::marker::PhantomData;
|
||||
pub(crate) use std::error::Error;
|
||||
pub(crate) use ::tek_edn::*;
|
||||
/// Standard result type.
|
||||
pub type Usually<T> = Result<T, Box<dyn Error>>;
|
||||
/// Standard optional result type.
|
||||
pub type Perhaps<T> = Result<Option<T>, Box<dyn Error>>;
|
||||
#[cfg(test)] #[test] fn test_stub_output () -> Usually<()> {
|
||||
use crate::*;
|
||||
struct TestOutput([u16;4]);
|
||||
impl Output for TestOutput {
|
||||
type Unit = u16;
|
||||
type Size = [u16;2];
|
||||
type Area = [u16;4];
|
||||
fn area (&self) -> [u16;4] {
|
||||
self.0
|
||||
}
|
||||
fn area_mut (&mut self) -> &mut [u16;4] {
|
||||
&mut self.0
|
||||
}
|
||||
fn place (&mut self, _: [u16;4], _: &impl Render<TestOutput>) {
|
||||
()
|
||||
}
|
||||
}
|
||||
impl Content<TestOutput> for String {
|
||||
fn render (&self, to: &mut TestOutput) {
|
||||
to.area_mut().set_w(self.len() as u16);
|
||||
}
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
#[cfg(test)] #[test] fn test_dimensions () {
|
||||
use crate::*;
|
||||
assert_eq!(Area::center(&[10u16, 10, 20, 20]), [20, 20]);
|
||||
}
|
||||
#[cfg(test)] #[test] fn test_layout () -> Usually<()> {
|
||||
Ok(())
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue