From 264a7dedd42e27cd9e604037640cf0594b2ec46b Mon Sep 17 00:00:00 2001 From: Laurenz Date: Fri, 19 Mar 2021 17:57:31 +0100 Subject: =?UTF-8?q?Scheduled=20maintenance=20=F0=9F=94=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 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 --- src/layout/node.rs | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) (limited to 'src/layout/node.rs') 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); +pub struct AnyNode(Box); -impl NodeAny { +impl AnyNode { /// Create a new instance from any node that satisifies the required bounds. pub fn new(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 From for Node where - T: Into, + T: Into, { fn from(t: T) -> Self { Self::Any(t.into()) -- cgit v1.2.3