summaryrefslogtreecommitdiff
path: root/src/func
diff options
context:
space:
mode:
authorLaurenz <laurmaedje@gmail.com>2019-12-12 23:33:26 +0100
committerLaurenz <laurmaedje@gmail.com>2019-12-12 23:33:26 +0100
commitf549914ff8d66e48e779d4d99898a224bd1ab701 (patch)
tree12dddf9feb18a39bc05aa69fe8d9b5eac802dfaf /src/func
parentff107cf3e75acf041f8b7631337d299cdeaa1685 (diff)
Refine and rename layouting types 🛀
Diffstat (limited to 'src/func')
-rw-r--r--src/func/mod.rs16
1 files changed, 5 insertions, 11 deletions
diff --git a/src/func/mod.rs b/src/func/mod.rs
index c8cf23c6..a5328314 100644
--- a/src/func/mod.rs
+++ b/src/func/mod.rs
@@ -12,13 +12,7 @@ mod macros;
/// Useful imports for creating your own functions.
pub mod prelude {
pub use crate::func::{Scope, ParseFunc, LayoutFunc, Command, Commands};
- pub use crate::layout::{
- layout_tree, Layout, MultiLayout,
- LayoutContext, LayoutSpace, LayoutSpaces, LayoutExpansion,
- LayoutAxes, Axis, GenericAxisKind, SpecificAxisKind,
- LayoutAlignment, Alignment,
- SpacingKind, LayoutResult,
- };
+ pub use crate::layout::prelude::*;
pub use crate::syntax::{
parse, ParseContext, ParseResult,
SyntaxTree, FuncCall, FuncArgs, PosArg, KeyArg,
@@ -107,7 +101,7 @@ pub enum Command<'a> {
Add(Layout),
AddMultiple(MultiLayout),
- AddSpacing(Size, SpacingKind, GenericAxisKind),
+ AddSpacing(Size, SpacingKind, GenericAxis),
FinishLine,
FinishRun,
@@ -149,13 +143,13 @@ impl Scope {
/// Associate the given name with a type that is parseable into a function.
pub fn add<F>(&mut self, name: &str)
where F: ParseFunc<Meta=()> + LayoutFunc + 'static {
- self.add_with_metadata::<F, ()>(name, ());
+ self.add_with_metadata::<F>(name, ());
}
/// Add a parseable type with additional metadata that is given to the
/// parser (other than the default of `()`).
- pub fn add_with_metadata<F, T>(&mut self, name: &str, metadata: T)
- where F: ParseFunc<Meta=T> + LayoutFunc + 'static, T: 'static + Clone {
+ pub fn add_with_metadata<F>(&mut self, name: &str, metadata: <F as ParseFunc>::Meta)
+ where F: ParseFunc + LayoutFunc + 'static {
self.parsers.insert(
name.to_owned(),
Box::new(move |a, b, c| {