mirror of
https://codeberg.org/unspeaker/tengri.git
synced 2026-02-21 10:39:03 +01:00
refactor: Namespace::resolve* -> Namespace::namespace*
This commit is contained in:
parent
04db6f4af5
commit
7a8365c017
2 changed files with 16 additions and 16 deletions
|
|
@ -189,12 +189,12 @@ pub fn evaluate_output_expression <'a, O: Out + 'a, S> (
|
||||||
match frags.next() {
|
match frags.next() {
|
||||||
|
|
||||||
Some("when") => output.place(&When::new(
|
Some("when") => output.place(&When::new(
|
||||||
state.resolve(arg0?)?.unwrap(),
|
state.namespace(arg0?)?.unwrap(),
|
||||||
Thunk::new(move|output: &mut O|state.view(output, &arg1).unwrap())
|
Thunk::new(move|output: &mut O|state.view(output, &arg1).unwrap())
|
||||||
)),
|
)),
|
||||||
|
|
||||||
Some("either") => output.place(&Either::new(
|
Some("either") => output.place(&Either::new(
|
||||||
state.resolve(arg0?)?.unwrap(),
|
state.namespace(arg0?)?.unwrap(),
|
||||||
Thunk::new(move|output: &mut O|state.view(output, &arg1).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.view(output, &arg2).unwrap())
|
||||||
)),
|
)),
|
||||||
|
|
@ -242,9 +242,9 @@ pub fn evaluate_output_expression <'a, O: Out + 'a, S> (
|
||||||
let arg = match axis { Some("x") | Some("y") => arg1, Some("xy") | None => arg2, _ => panic!("fixed: unsupported axis {axis:?}") };
|
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.view(output, &arg).unwrap());
|
||||||
match axis {
|
match axis {
|
||||||
Some("xy") | None => Fixed::XY(state.resolve(arg0?)?.unwrap(), state.resolve(arg1?)?.unwrap(), cb),
|
Some("xy") | None => Fixed::XY(state.namespace(arg0?)?.unwrap(), state.namespace(arg1?)?.unwrap(), cb),
|
||||||
Some("x") => Fixed::X(state.resolve(arg0?)?.unwrap(), cb),
|
Some("x") => Fixed::X(state.namespace(arg0?)?.unwrap(), cb),
|
||||||
Some("y") => Fixed::Y(state.resolve(arg0?)?.unwrap(), cb),
|
Some("y") => Fixed::Y(state.namespace(arg0?)?.unwrap(), cb),
|
||||||
frag => unimplemented!("fixed/{frag:?} ({expr:?}) ({head:?}) ({:?})",
|
frag => unimplemented!("fixed/{frag:?} ({expr:?}) ({head:?}) ({:?})",
|
||||||
head.src()?.unwrap_or_default().split("/").next())
|
head.src()?.unwrap_or_default().split("/").next())
|
||||||
}
|
}
|
||||||
|
|
@ -255,9 +255,9 @@ pub fn evaluate_output_expression <'a, O: Out + 'a, S> (
|
||||||
let arg = match axis { Some("x") | Some("y") => arg1, Some("xy") | None => arg2, _ => panic!("fixed: unsupported axis {axis:?}") };
|
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.view(output, &arg).unwrap());
|
||||||
match axis {
|
match axis {
|
||||||
Some("xy") | None => Min::XY(state.resolve(arg0?)?.unwrap(), state.resolve(arg1?)?.unwrap(), cb),
|
Some("xy") | None => Min::XY(state.namespace(arg0?)?.unwrap(), state.namespace(arg1?)?.unwrap(), cb),
|
||||||
Some("x") => Min::X(state.resolve(arg0?)?.unwrap(), cb),
|
Some("x") => Min::X(state.namespace(arg0?)?.unwrap(), cb),
|
||||||
Some("y") => Min::Y(state.resolve(arg0?)?.unwrap(), cb),
|
Some("y") => Min::Y(state.namespace(arg0?)?.unwrap(), cb),
|
||||||
frag => unimplemented!("min/{frag:?}")
|
frag => unimplemented!("min/{frag:?}")
|
||||||
}
|
}
|
||||||
}),
|
}),
|
||||||
|
|
@ -267,9 +267,9 @@ pub fn evaluate_output_expression <'a, O: Out + 'a, S> (
|
||||||
let arg = match axis { Some("x") | Some("y") => arg1, Some("xy") | None => arg2, _ => panic!("fixed: unsupported axis {axis:?}") };
|
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.view(output, &arg).unwrap());
|
||||||
match axis {
|
match axis {
|
||||||
Some("xy") | None => Max::XY(state.resolve(arg0?)?.unwrap(), state.resolve(arg1?)?.unwrap(), cb),
|
Some("xy") | None => Max::XY(state.namespace(arg0?)?.unwrap(), state.namespace(arg1?)?.unwrap(), cb),
|
||||||
Some("x") => Max::X(state.resolve(arg0?)?.unwrap(), cb),
|
Some("x") => Max::X(state.namespace(arg0?)?.unwrap(), cb),
|
||||||
Some("y") => Max::Y(state.resolve(arg0?)?.unwrap(), cb),
|
Some("y") => Max::Y(state.namespace(arg0?)?.unwrap(), cb),
|
||||||
frag => unimplemented!("max/{frag:?}")
|
frag => unimplemented!("max/{frag:?}")
|
||||||
}
|
}
|
||||||
}),
|
}),
|
||||||
|
|
@ -279,9 +279,9 @@ pub fn evaluate_output_expression <'a, O: Out + 'a, S> (
|
||||||
let arg = match axis { Some("x") | Some("y") => arg1, Some("xy") | None => arg2, _ => panic!("fixed: unsupported axis {axis:?}") };
|
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.view(output, &arg).unwrap());
|
||||||
match axis {
|
match axis {
|
||||||
Some("xy") | None => Push::XY(state.resolve(arg0?)?.unwrap(), state.resolve(arg1?)?.unwrap(), cb),
|
Some("xy") | None => Push::XY(state.namespace(arg0?)?.unwrap(), state.namespace(arg1?)?.unwrap(), cb),
|
||||||
Some("x") => Push::X(state.resolve(arg0?)?.unwrap(), cb),
|
Some("x") => Push::X(state.namespace(arg0?)?.unwrap(), cb),
|
||||||
Some("y") => Push::Y(state.resolve(arg0?)?.unwrap(), cb),
|
Some("y") => Push::Y(state.namespace(arg0?)?.unwrap(), cb),
|
||||||
frag => unimplemented!("push/{frag:?}")
|
frag => unimplemented!("push/{frag:?}")
|
||||||
}
|
}
|
||||||
}),
|
}),
|
||||||
|
|
|
||||||
|
|
@ -262,7 +262,7 @@ pub fn tui_input <T: Handle<TuiIn> + Send + Sync + 'static> (
|
||||||
Some("fg") => {
|
Some("fg") => {
|
||||||
let arg0 = arg0?.expect("fg: expected arg 0 (color)");
|
let arg0 = arg0?.expect("fg: expected arg 0 (color)");
|
||||||
output.place(&Tui::fg(
|
output.place(&Tui::fg(
|
||||||
Namespace::<Color>::resolve(state, arg0)?.unwrap_or_else(||panic!("fg: {arg0:?}: not a color")),
|
Namespace::<Color>::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.view(output, &arg1).unwrap()),
|
||||||
))
|
))
|
||||||
},
|
},
|
||||||
|
|
@ -270,7 +270,7 @@ pub fn tui_input <T: Handle<TuiIn> + Send + Sync + 'static> (
|
||||||
Some("bg") => {
|
Some("bg") => {
|
||||||
let arg0 = arg0?.expect("bg: expected arg 0 (color)");
|
let arg0 = arg0?.expect("bg: expected arg 0 (color)");
|
||||||
output.place(&Tui::bg(
|
output.place(&Tui::bg(
|
||||||
Namespace::<Color>::resolve(state, arg0)?.unwrap_or_else(||panic!("bg: {arg0:?}: not a color")),
|
Namespace::<Color>::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.view(output, &arg1).unwrap()),
|
||||||
))
|
))
|
||||||
},
|
},
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue