mirror of
https://codeberg.org/unspeaker/tek.git
synced 2025-12-07 20:26:42 +01:00
once again, why did i begin to refactor this
This commit is contained in:
parent
297f9b30df
commit
798de37172
15 changed files with 582 additions and 602 deletions
|
|
@ -1,4 +1,5 @@
|
|||
use crate::*;
|
||||
use RefAtom::*;
|
||||
#[derive(Debug, Copy, Clone, Default)] pub enum Alignment { #[default] Center, X, Y, NW, N, NE, E, SE, S, SW, W }
|
||||
pub struct Align<E, A>(PhantomData<E>, Alignment, A);
|
||||
impl<E, A> Align<E, A> {
|
||||
|
|
@ -44,13 +45,12 @@ impl<E: Output, A: Content<E>> Content<E> for Align<E, A> {
|
|||
to.place(Content::layout(self, to.area()), &self.content())
|
||||
}
|
||||
}
|
||||
impl<'a, E: Output + 'a, T: EdnViewData<'a, E>> TryFromEdn<'a, T> for Align<E, RenderBox<'a, E>> {
|
||||
impl<'a, E: Output + 'a, T: ViewContext<'a, E>> TryFromEdn<'a, T> for Align<E, RenderBox<'a, E>> {
|
||||
fn try_from_edn (
|
||||
state: &'a T,
|
||||
head: &Atom<impl AsRef<str>>,
|
||||
tail: &'a [Atom<impl AsRef<str>>]
|
||||
head: &impl Atom,
|
||||
tail: &'a [impl Atom]
|
||||
) -> Option<Self> {
|
||||
use Atom::*;
|
||||
Some(match (head.to_ref(), tail) {
|
||||
(Key("align/c"), [a]) => Self::c(state.get_content(a).expect("no content")),
|
||||
(Key("align/x"), [a]) => Self::x(state.get_content(a).expect("no content")),
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue