diff options
| author | Laurenz <laurmaedje@gmail.com> | 2020-01-24 12:44:04 +0100 |
|---|---|---|
| committer | Laurenz <laurmaedje@gmail.com> | 2020-01-24 12:44:04 +0100 |
| commit | 03fddaf3aea778057aedd74dbcb27bae971ec22f (patch) | |
| tree | 37e3136e29e0e5d69ec8f56e43d156739d2931ab /src/library/direction.rs | |
| parent | 78da2bdd5d77d1b8572e5e9da119bfa68127a3fa (diff) | |
Non-fatal argument parsing 🌋
Diffstat (limited to 'src/library/direction.rs')
| -rw-r--r-- | src/library/direction.rs | 43 |
1 files changed, 0 insertions, 43 deletions
diff --git a/src/library/direction.rs b/src/library/direction.rs deleted file mode 100644 index b7a6e212..00000000 --- a/src/library/direction.rs +++ /dev/null @@ -1,43 +0,0 @@ -use crate::func::prelude::*; -use super::maps::PosAxisMap; - - -function! { - /// `direction`: Sets the directions of the layouting axes. - #[derive(Debug, PartialEq)] - pub struct DirectionFunc { - body: Option<SyntaxTree>, - map: PosAxisMap<Direction>, - } - - parse(header, body, ctx) { - DirectionFunc { - body: parse!(optional: body, ctx), - map: PosAxisMap::new(&mut header.args)?, - } - } - - layout(self, mut ctx) { - ctx.base = ctx.spaces[0].dimensions; - - let map = self.map.dedup(ctx.axes, |direction| { - Some(direction.axis().to_generic(ctx.axes)) - })?; - - map.with(Primary, |&dir| ctx.axes.primary = dir); - map.with(Secondary, |&dir| ctx.axes.secondary = dir); - - if ctx.axes.primary.axis() == ctx.axes.secondary.axis() { - error!( - "invalid aligned primary and secondary axes: `{}`, `{}`", - format!("{:?}", ctx.axes.primary).to_lowercase(), - format!("{:?}", ctx.axes.secondary).to_lowercase(), - ); - } - - match &self.body { - Some(body) => vec![AddMultiple(layout(&body, ctx).await?)], - None => vec![Command::SetAxes(ctx.axes)], - } - } -} |
