extern crate alloc;
mod batch;
mod collation;
mod examples;
mod foundations;
mod properties;
use crate::kairos::{Clock, TickCounter};
use crate::metis::dot::RawDot;
use crate::metis::{Composer, Dot, DotSet, Locus, Metatheses, Metathesis, Rhapsody};
#[track_caller]
fn d(station: u32, counter: u64) -> Dot {
Dot::from_parts(station, counter).expect("test literal names the non-dot counter zero")
}
type Text = Composer<Rhapsody>;
type Moves = Composer<Metatheses>;
fn clock(station: u32) -> Clock<TickCounter> {
Clock::with_default_config(TickCounter::new(), station).unwrap()
}
fn type_after(text: &mut Text, clk: &Clock<TickCounter>, after: Option<RawDot>) -> Dot {
let anchor = text.state().store().anchor_for_visual_insert(after);
if let Some(top) = text.state().store().children_of(anchor).next()
&& let Some(locus) = text.state().store().locus(top)
{
clk.observe(locus.rank);
}
let rank = clk.now(0u16);
let (dot, _) = text.compose(|dot| {
let mut delta = Rhapsody::new();
assert!(delta.weave(dot, Locus { anchor, rank }));
(delta, DotSet::new())
});
dot
}
fn move_to(
moves: &mut Moves,
target: RawDot,
to: Locus,
) -> (Dot, crate::metis::Dotted<Metatheses>) {
moves.compose(|dot| {
(
Metatheses::singleton(dot, Metathesis { target, to }),
DotSet::new(),
)
})
}
fn locus_at(clk: &Clock<TickCounter>, anchor: crate::metis::Anchor) -> Locus {
Locus {
anchor,
rank: clk.now(0u16),
}
}