diff options
| author | Laurenz <laurmaedje@gmail.com> | 2021-03-19 17:57:31 +0100 |
|---|---|---|
| committer | Laurenz <laurmaedje@gmail.com> | 2021-03-19 17:57:31 +0100 |
| commit | 264a7dedd42e27cd9e604037640cf0594b2ec46b (patch) | |
| tree | d26feea399d54bb86bd44878f40293983bf5251d /src/layout/node.rs | |
| parent | ca3df70e2a5069832d7d2135967674c34a155442 (diff) | |
Scheduled maintenance 🔨
- New naming scheme
- TextNode instead of NodeText
- CallExpr instead of ExprCall
- ...
- Less glob imports
- Removes Value::Args variant
- Removes prelude
- Renames Layouted to Fragment
- Moves font into env
- Moves shaping into layout
- Moves frame into separate module
Diffstat (limited to 'src/layout/node.rs')
| -rw-r--r-- | src/layout/node.rs | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/src/layout/node.rs b/src/layout/node.rs index fa7fe010..443a96ae 100644 --- a/src/layout/node.rs +++ b/src/layout/node.rs @@ -7,15 +7,15 @@ use super::*; #[derive(Clone, PartialEq)] pub enum Node { /// A text node. - Text(NodeText), + Text(TextNode), /// A spacing node. - Spacing(NodeSpacing), + Spacing(SpacingNode), /// A dynamic node that can implement custom layouting behaviour. - Any(NodeAny), + Any(AnyNode), } impl Layout for Node { - fn layout(&self, ctx: &mut LayoutContext, areas: &Areas) -> Layouted { + fn layout(&self, ctx: &mut LayoutContext, areas: &Areas) -> Fragment { match self { Self::Spacing(spacing) => spacing.layout(ctx, areas), Self::Text(text) => text.layout(ctx, areas), @@ -35,9 +35,9 @@ impl Debug for Node { } /// A wrapper around a dynamic layouting node. -pub struct NodeAny(Box<dyn Bounds>); +pub struct AnyNode(Box<dyn Bounds>); -impl NodeAny { +impl AnyNode { /// Create a new instance from any node that satisifies the required bounds. pub fn new<T>(any: T) -> Self where @@ -47,25 +47,25 @@ impl NodeAny { } } -impl Layout for NodeAny { - fn layout(&self, ctx: &mut LayoutContext, areas: &Areas) -> Layouted { +impl Layout for AnyNode { + fn layout(&self, ctx: &mut LayoutContext, areas: &Areas) -> Fragment { self.0.layout(ctx, areas) } } -impl Clone for NodeAny { +impl Clone for AnyNode { fn clone(&self) -> Self { Self(self.0.dyn_clone()) } } -impl PartialEq for NodeAny { +impl PartialEq for AnyNode { fn eq(&self, other: &Self) -> bool { self.0.dyn_eq(other.0.as_ref()) } } -impl Debug for NodeAny { +impl Debug for AnyNode { fn fmt(&self, f: &mut Formatter) -> fmt::Result { self.0.fmt(f) } @@ -73,7 +73,7 @@ impl Debug for NodeAny { impl<T> From<T> for Node where - T: Into<NodeAny>, + T: Into<AnyNode>, { fn from(t: T) -> Self { Self::Any(t.into()) |
