Skip to content

Commit

Permalink
Rename new_node to new_with_children (#142)
Browse files Browse the repository at this point in the history
* Update Releases

* renamed taffy::node::Taffy.new-node(..) -> taffy::node::Taffy.new_with_children(..)

* renamed `taffy::forest::Forest.new-node(..)` -> `taffy::forest::Forest.new_with_children(..)`
  • Loading branch information
Weibye authored Jun 10, 2022
1 parent 55cd70b commit d960ac1
Show file tree
Hide file tree
Showing 487 changed files with 1,710 additions and 1,587 deletions.
2 changes: 2 additions & 0 deletions RELEASES.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@

### 0.2.0 Changed

- renamed `taffy::forest::Forest.new-node(..)` `taffy::forest::Forest.new_with_children(..)`
- renamed `taffy::node::Taffy.new-node(..)` -> `taffy::node::Taffy.new_with_children(..)`
- renamed `taffy::style::Style` -> `taffy::style::FlexboxLayout` to more precicely indicate its purpose

### 0.2.0 Fixed
Expand Down
36 changes: 21 additions & 15 deletions benches/complex.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ use criterion::{criterion_group, criterion_main, Criterion};

fn build_deep_hierarchy(taffy: &mut taffy::node::Taffy) -> taffy::node::Node {
let node111 = taffy
.new_node(
.new_with_children(
taffy::style::FlexboxLayout {
size: taffy::geometry::Size {
width: taffy::style::Dimension::Points(10.0),
Expand All @@ -14,7 +14,7 @@ fn build_deep_hierarchy(taffy: &mut taffy::node::Taffy) -> taffy::node::Node {
)
.unwrap();
let node112 = taffy
.new_node(
.new_with_children(
taffy::style::FlexboxLayout {
size: taffy::geometry::Size {
width: taffy::style::Dimension::Points(10.0),
Expand All @@ -27,7 +27,7 @@ fn build_deep_hierarchy(taffy: &mut taffy::node::Taffy) -> taffy::node::Node {
.unwrap();

let node121 = taffy
.new_node(
.new_with_children(
taffy::style::FlexboxLayout {
size: taffy::geometry::Size {
width: taffy::style::Dimension::Points(10.0),
Expand All @@ -39,7 +39,7 @@ fn build_deep_hierarchy(taffy: &mut taffy::node::Taffy) -> taffy::node::Node {
)
.unwrap();
let node122 = taffy
.new_node(
.new_with_children(
taffy::style::FlexboxLayout {
size: taffy::geometry::Size {
width: taffy::style::Dimension::Points(10.0),
Expand All @@ -51,12 +51,15 @@ fn build_deep_hierarchy(taffy: &mut taffy::node::Taffy) -> taffy::node::Node {
)
.unwrap();

let node11 = taffy.new_node(taffy::style::FlexboxLayout { ..Default::default() }, &[node111, node112]).unwrap();
let node12 = taffy.new_node(taffy::style::FlexboxLayout { ..Default::default() }, &[node121, node122]).unwrap();
let node1 = taffy.new_node(taffy::style::FlexboxLayout { ..Default::default() }, &[node11, node12]).unwrap();
let node11 =
taffy.new_with_children(taffy::style::FlexboxLayout { ..Default::default() }, &[node111, node112]).unwrap();
let node12 =
taffy.new_with_children(taffy::style::FlexboxLayout { ..Default::default() }, &[node121, node122]).unwrap();
let node1 =
taffy.new_with_children(taffy::style::FlexboxLayout { ..Default::default() }, &[node11, node12]).unwrap();

let node211 = taffy
.new_node(
.new_with_children(
taffy::style::FlexboxLayout {
size: taffy::geometry::Size {
width: taffy::style::Dimension::Points(10.0),
Expand All @@ -68,7 +71,7 @@ fn build_deep_hierarchy(taffy: &mut taffy::node::Taffy) -> taffy::node::Node {
)
.unwrap();
let node212 = taffy
.new_node(
.new_with_children(
taffy::style::FlexboxLayout {
size: taffy::geometry::Size {
width: taffy::style::Dimension::Points(10.0),
Expand All @@ -81,7 +84,7 @@ fn build_deep_hierarchy(taffy: &mut taffy::node::Taffy) -> taffy::node::Node {
.unwrap();

let node221 = taffy
.new_node(
.new_with_children(
taffy::style::FlexboxLayout {
size: taffy::geometry::Size {
width: taffy::style::Dimension::Points(10.0),
Expand All @@ -93,7 +96,7 @@ fn build_deep_hierarchy(taffy: &mut taffy::node::Taffy) -> taffy::node::Node {
)
.unwrap();
let node222 = taffy
.new_node(
.new_with_children(
taffy::style::FlexboxLayout {
size: taffy::geometry::Size {
width: taffy::style::Dimension::Points(10.0),
Expand All @@ -105,12 +108,15 @@ fn build_deep_hierarchy(taffy: &mut taffy::node::Taffy) -> taffy::node::Node {
)
.unwrap();

let node21 = taffy.new_node(taffy::style::FlexboxLayout { ..Default::default() }, &[node211, node212]).unwrap();
let node22 = taffy.new_node(taffy::style::FlexboxLayout { ..Default::default() }, &[node221, node222]).unwrap();
let node21 =
taffy.new_with_children(taffy::style::FlexboxLayout { ..Default::default() }, &[node211, node212]).unwrap();
let node22 =
taffy.new_with_children(taffy::style::FlexboxLayout { ..Default::default() }, &[node221, node222]).unwrap();

let node2 = taffy.new_node(taffy::style::FlexboxLayout { ..Default::default() }, &[node21, node22]).unwrap();
let node2 =
taffy.new_with_children(taffy::style::FlexboxLayout { ..Default::default() }, &[node21, node22]).unwrap();

taffy.new_node(taffy::style::FlexboxLayout { ..Default::default() }, &[node1, node2]).unwrap()
taffy.new_with_children(taffy::style::FlexboxLayout { ..Default::default() }, &[node1, node2]).unwrap()
}

fn taffy_benchmarks(c: &mut Criterion) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
pub fn compute() {
let mut taffy = taffy::Taffy::new();
let node0 = taffy
.new_node(
.new_with_children(
taffy::style::FlexboxLayout {
position_type: taffy::style::PositionType::Absolute,
size: taffy::geometry::Size {
Expand All @@ -15,7 +15,7 @@ pub fn compute() {
)
.unwrap();
let node = taffy
.new_node(
.new_with_children(
taffy::style::FlexboxLayout {
align_items: taffy::style::AlignItems::Center,
justify_content: taffy::style::JustifyContent::Center,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
pub fn compute() {
let mut taffy = taffy::Taffy::new();
let node0 = taffy
.new_node(
.new_with_children(
taffy::style::FlexboxLayout {
position_type: taffy::style::PositionType::Absolute,
size: taffy::geometry::Size {
Expand All @@ -19,7 +19,7 @@ pub fn compute() {
)
.unwrap();
let node = taffy
.new_node(
.new_with_children(
taffy::style::FlexboxLayout {
align_items: taffy::style::AlignItems::Center,
justify_content: taffy::style::JustifyContent::Center,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
pub fn compute() {
let mut taffy = taffy::Taffy::new();
let node0 = taffy
.new_node(
.new_with_children(
taffy::style::FlexboxLayout {
position_type: taffy::style::PositionType::Absolute,
size: taffy::geometry::Size {
Expand All @@ -16,7 +16,7 @@ pub fn compute() {
)
.unwrap();
let node = taffy
.new_node(
.new_with_children(
taffy::style::FlexboxLayout {
align_items: taffy::style::AlignItems::Center,
justify_content: taffy::style::JustifyContent::Center,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
pub fn compute() {
let mut taffy = taffy::Taffy::new();
let node0 = taffy
.new_node(
.new_with_children(
taffy::style::FlexboxLayout {
position_type: taffy::style::PositionType::Absolute,
size: taffy::geometry::Size {
Expand All @@ -16,7 +16,7 @@ pub fn compute() {
)
.unwrap();
let node = taffy
.new_node(
.new_with_children(
taffy::style::FlexboxLayout {
align_items: taffy::style::AlignItems::Center,
justify_content: taffy::style::JustifyContent::Center,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
pub fn compute() {
let mut taffy = taffy::Taffy::new();
let node0 = taffy
.new_node(
.new_with_children(
taffy::style::FlexboxLayout {
position_type: taffy::style::PositionType::Absolute,
size: taffy::geometry::Size {
Expand All @@ -16,7 +16,7 @@ pub fn compute() {
)
.unwrap();
let node = taffy
.new_node(
.new_with_children(
taffy::style::FlexboxLayout {
align_items: taffy::style::AlignItems::Center,
justify_content: taffy::style::JustifyContent::Center,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
pub fn compute() {
let mut taffy = taffy::Taffy::new();
let node0 = taffy
.new_node(
.new_with_children(
taffy::style::FlexboxLayout {
position_type: taffy::style::PositionType::Absolute,
size: taffy::geometry::Size {
Expand All @@ -15,7 +15,7 @@ pub fn compute() {
)
.unwrap();
let node = taffy
.new_node(
.new_with_children(
taffy::style::FlexboxLayout {
align_items: taffy::style::AlignItems::FlexEnd,
justify_content: taffy::style::JustifyContent::FlexEnd,
Expand Down
4 changes: 2 additions & 2 deletions benches/generated/absolute_layout_align_items_center.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
pub fn compute() {
let mut taffy = taffy::Taffy::new();
let node0 = taffy
.new_node(
.new_with_children(
taffy::style::FlexboxLayout {
position_type: taffy::style::PositionType::Absolute,
size: taffy::geometry::Size {
Expand All @@ -15,7 +15,7 @@ pub fn compute() {
)
.unwrap();
let node = taffy
.new_node(
.new_with_children(
taffy::style::FlexboxLayout {
align_items: taffy::style::AlignItems::Center,
size: taffy::geometry::Size {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
pub fn compute() {
let mut taffy = taffy::Taffy::new();
let node0 = taffy
.new_node(
.new_with_children(
taffy::style::FlexboxLayout {
position_type: taffy::style::PositionType::Absolute,
align_self: taffy::style::AlignSelf::Center,
Expand All @@ -16,7 +16,7 @@ pub fn compute() {
)
.unwrap();
let node = taffy
.new_node(
.new_with_children(
taffy::style::FlexboxLayout {
size: taffy::geometry::Size {
width: taffy::style::Dimension::Points(110f32),
Expand Down
8 changes: 4 additions & 4 deletions benches/generated/absolute_layout_child_order.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
pub fn compute() {
let mut taffy = taffy::Taffy::new();
let node0 = taffy
.new_node(
.new_with_children(
taffy::style::FlexboxLayout {
size: taffy::geometry::Size {
width: taffy::style::Dimension::Points(60f32),
Expand All @@ -14,7 +14,7 @@ pub fn compute() {
)
.unwrap();
let node1 = taffy
.new_node(
.new_with_children(
taffy::style::FlexboxLayout {
position_type: taffy::style::PositionType::Absolute,
size: taffy::geometry::Size {
Expand All @@ -28,7 +28,7 @@ pub fn compute() {
)
.unwrap();
let node2 = taffy
.new_node(
.new_with_children(
taffy::style::FlexboxLayout {
size: taffy::geometry::Size {
width: taffy::style::Dimension::Points(60f32),
Expand All @@ -41,7 +41,7 @@ pub fn compute() {
)
.unwrap();
let node = taffy
.new_node(
.new_with_children(
taffy::style::FlexboxLayout {
align_items: taffy::style::AlignItems::Center,
justify_content: taffy::style::JustifyContent::Center,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
pub fn compute() {
let mut taffy = taffy::Taffy::new();
let node0 = taffy
.new_node(
.new_with_children(
taffy::style::FlexboxLayout {
position_type: taffy::style::PositionType::Absolute,
size: taffy::geometry::Size {
Expand All @@ -15,7 +15,7 @@ pub fn compute() {
)
.unwrap();
let node = taffy
.new_node(
.new_with_children(
taffy::style::FlexboxLayout {
flex_direction: taffy::style::FlexDirection::Column,
flex_wrap: taffy::style::FlexWrap::WrapReverse,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
pub fn compute() {
let mut taffy = taffy::Taffy::new();
let node0 = taffy
.new_node(
.new_with_children(
taffy::style::FlexboxLayout {
position_type: taffy::style::PositionType::Absolute,
align_self: taffy::style::AlignSelf::FlexEnd,
Expand All @@ -16,7 +16,7 @@ pub fn compute() {
)
.unwrap();
let node = taffy
.new_node(
.new_with_children(
taffy::style::FlexboxLayout {
flex_direction: taffy::style::FlexDirection::Column,
flex_wrap: taffy::style::FlexWrap::WrapReverse,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
pub fn compute() {
let mut taffy = taffy::Taffy::new();
let node0 = taffy
.new_node(
.new_with_children(
taffy::style::FlexboxLayout {
position_type: taffy::style::PositionType::Absolute,
size: taffy::geometry::Size {
Expand All @@ -15,7 +15,7 @@ pub fn compute() {
)
.unwrap();
let node = taffy
.new_node(
.new_with_children(
taffy::style::FlexboxLayout {
flex_wrap: taffy::style::FlexWrap::WrapReverse,
size: taffy::geometry::Size {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
pub fn compute() {
let mut taffy = taffy::Taffy::new();
let node0 = taffy
.new_node(
.new_with_children(
taffy::style::FlexboxLayout {
position_type: taffy::style::PositionType::Absolute,
align_self: taffy::style::AlignSelf::FlexEnd,
Expand All @@ -16,7 +16,7 @@ pub fn compute() {
)
.unwrap();
let node = taffy
.new_node(
.new_with_children(
taffy::style::FlexboxLayout {
flex_wrap: taffy::style::FlexWrap::WrapReverse,
size: taffy::geometry::Size {
Expand Down
4 changes: 2 additions & 2 deletions benches/generated/absolute_layout_justify_content_center.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
pub fn compute() {
let mut taffy = taffy::Taffy::new();
let node0 = taffy
.new_node(
.new_with_children(
taffy::style::FlexboxLayout {
position_type: taffy::style::PositionType::Absolute,
size: taffy::geometry::Size {
Expand All @@ -15,7 +15,7 @@ pub fn compute() {
)
.unwrap();
let node = taffy
.new_node(
.new_with_children(
taffy::style::FlexboxLayout {
justify_content: taffy::style::JustifyContent::Center,
size: taffy::geometry::Size {
Expand Down
4 changes: 2 additions & 2 deletions benches/generated/absolute_layout_no_size.rs
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
pub fn compute() {
let mut taffy = taffy::Taffy::new();
let node0 = taffy
.new_node(
.new_with_children(
taffy::style::FlexboxLayout { position_type: taffy::style::PositionType::Absolute, ..Default::default() },
&[],
)
.unwrap();
let node = taffy
.new_node(
.new_with_children(
taffy::style::FlexboxLayout {
size: taffy::geometry::Size {
width: taffy::style::Dimension::Points(100f32),
Expand Down
Loading

0 comments on commit d960ac1

Please sign in to comment.