From 006cddcc16868aa626ecca6abf1c0f00523402fc Mon Sep 17 00:00:00 2001 From: same mf who else Date: Sat, 21 Feb 2026 18:21:50 +0200 Subject: [PATCH] view* -> understand* --- tengri/tengri.rs | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/tengri/tengri.rs b/tengri/tengri.rs index e488c78..e3310ec 100644 --- a/tengri/tengri.rs +++ b/tengri/tengri.rs @@ -80,10 +80,10 @@ pub(crate) use ::std::{ /// FIXME: This is generic: should be called `eval` and be part of [dizzle]. #[cfg(feature = "dsl")] #[macro_export] macro_rules! view { ($State:ident: $Output:ident: $namespaces:expr) => { - impl View<$Output, ()> for $State { - fn view_expr <'a> (&'a self, to: &mut $Output, expr: &'a impl Expression) -> Usually<()> { + impl Understand<$Output, ()> for $State { + fn understand_expr <'a> (&'a self, to: &mut $Output, expr: &'a impl Expression) -> Usually<()> { for namespace in $namespaces { if namespace(self, to, expr)? { return Ok(()) } } - Err(format!("{}::<{}, ()>::view_expr: unexpected: {expr:?}", + Err(format!("{}::<{}, ()>::understand_expr: unexpected: {expr:?}", stringify! { $State }, stringify! { $Output }).into()) } @@ -129,18 +129,18 @@ pub(crate) use ::std::{ Some("when") => output.place(&When::new( state.namespace(arg0?)?.unwrap(), - Thunk::new(move|output: &mut O|state.view(output, &arg1).unwrap()) + Thunk::new(move|output: &mut O|state.understand(output, &arg1).unwrap()) )), Some("either") => output.place(&Either::new( state.namespace(arg0?)?.unwrap(), - Thunk::new(move|output: &mut O|state.view(output, &arg1).unwrap()), - Thunk::new(move|output: &mut O|state.view(output, &arg2).unwrap()) + Thunk::new(move|output: &mut O|state.understand(output, &arg1).unwrap()), + Thunk::new(move|output: &mut O|state.understand(output, &arg2).unwrap()) )), Some("bsp") => output.place(&{ - let a = Thunk::new(move|output: &mut O|state.view(output, &arg0).unwrap()); - let b = Thunk::new(move|output: &mut O|state.view(output, &arg1).unwrap()); + let a = Thunk::new(move|output: &mut O|state.understand(output, &arg0).unwrap()); + let b = Thunk::new(move|output: &mut O|state.understand(output, &arg1).unwrap()); match frags.next() { Some("n") => Bsp::n(a, b), Some("s") => Bsp::s(a, b), @@ -153,7 +153,7 @@ pub(crate) use ::std::{ }), Some("align") => output.place(&{ - let a = Thunk::new(move|output: &mut O|state.view(output, &arg0).unwrap()); + let a = Thunk::new(move|output: &mut O|state.understand(output, &arg0).unwrap()); match frags.next() { Some("n") => Align::n(a), Some("s") => Align::s(a), @@ -167,7 +167,7 @@ pub(crate) use ::std::{ }), Some("fill") => output.place(&{ - let a = Thunk::new(move|output: &mut O|state.view(output, &arg0).unwrap()); + let a = Thunk::new(move|output: &mut O|state.understand(output, &arg0).unwrap()); match frags.next() { Some("xy") | None => Fill::XY(a), Some("x") => Fill::X(a), @@ -179,7 +179,7 @@ pub(crate) use ::std::{ Some("fixed") => output.place(&{ let axis = frags.next(); let arg = match axis { Some("x") | Some("y") => arg1, Some("xy") | None => arg2, _ => panic!("fixed: unsupported axis {axis:?}") }; - let cb = Thunk::new(move|output: &mut O|state.view(output, &arg).unwrap()); + let cb = Thunk::new(move|output: &mut O|state.understand(output, &arg).unwrap()); match axis { Some("xy") | None => Fixed::XY(state.namespace(arg0?)?.unwrap(), state.namespace(arg1?)?.unwrap(), cb), Some("x") => Fixed::X(state.namespace(arg0?)?.unwrap(), cb), @@ -192,7 +192,7 @@ pub(crate) use ::std::{ Some("min") => output.place(&{ let axis = frags.next(); let arg = match axis { Some("x") | Some("y") => arg1, Some("xy") | None => arg2, _ => panic!("fixed: unsupported axis {axis:?}") }; - let cb = Thunk::new(move|output: &mut O|state.view(output, &arg).unwrap()); + let cb = Thunk::new(move|output: &mut O|state.understand(output, &arg).unwrap()); match axis { Some("xy") | None => Min::XY(state.namespace(arg0?)?.unwrap(), state.namespace(arg1?)?.unwrap(), cb), Some("x") => Min::X(state.namespace(arg0?)?.unwrap(), cb), @@ -204,7 +204,7 @@ pub(crate) use ::std::{ Some("max") => output.place(&{ let axis = frags.next(); let arg = match axis { Some("x") | Some("y") => arg1, Some("xy") | None => arg2, _ => panic!("fixed: unsupported axis {axis:?}") }; - let cb = Thunk::new(move|output: &mut O|state.view(output, &arg).unwrap()); + let cb = Thunk::new(move|output: &mut O|state.understand(output, &arg).unwrap()); match axis { Some("xy") | None => Max::XY(state.namespace(arg0?)?.unwrap(), state.namespace(arg1?)?.unwrap(), cb), Some("x") => Max::X(state.namespace(arg0?)?.unwrap(), cb), @@ -216,7 +216,7 @@ pub(crate) use ::std::{ Some("push") => output.place(&{ let axis = frags.next(); let arg = match axis { Some("x") | Some("y") => arg1, Some("xy") | None => arg2, _ => panic!("fixed: unsupported axis {axis:?}") }; - let cb = Thunk::new(move|output: &mut O|state.view(output, &arg).unwrap()); + let cb = Thunk::new(move|output: &mut O|state.understand(output, &arg).unwrap()); match axis { Some("xy") | None => Push::XY(state.namespace(arg0?)?.unwrap(), state.namespace(arg1?)?.unwrap(), cb), Some("x") => Push::X(state.namespace(arg0?)?.unwrap(), cb), @@ -478,7 +478,7 @@ pub fn tui_input + Send + Sync + 'static> ( let arg0 = arg0?.expect("fg: expected arg 0 (color)"); output.place(&Tui::fg( Namespace::::namespace(state, arg0)?.unwrap_or_else(||panic!("fg: {arg0:?}: not a color")), - Thunk::new(move|output: &mut TuiOut|state.view(output, &arg1).unwrap()), + Thunk::new(move|output: &mut TuiOut|state.understand(output, &arg1).unwrap()), )) }, @@ -486,7 +486,7 @@ pub fn tui_input + Send + Sync + 'static> ( let arg0 = arg0?.expect("bg: expected arg 0 (color)"); output.place(&Tui::bg( Namespace::::namespace(state, arg0)?.unwrap_or_else(||panic!("bg: {arg0:?}: not a color")), - Thunk::new(move|output: &mut TuiOut|state.view(output, &arg1).unwrap()), + Thunk::new(move|output: &mut TuiOut|state.understand(output, &arg1).unwrap()), )) },