diff --git a/Cargo.lock b/Cargo.lock index 0df94aa..23b41d1 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -123,7 +123,7 @@ dependencies = [ [[package]] name = "taitank-safe" -version = "0.0.1" +version = "0.0.6" dependencies = [ "cxx", "cxx-build", diff --git a/Cargo.toml b/Cargo.toml index cc86aba..81195fb 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "taitank-safe" -version = "0.0.1" +version = "0.0.6" description = "taitank in safe rust" include = ["/src", "README.md", "/include/safe.h", "/include/taitank/src", ".gitmodules", "build.rs"] license = "MIT" diff --git a/README.md b/README.md index e557062..f40d74a 100644 --- a/README.md +++ b/README.md @@ -1,29 +1,44 @@ # Taitank Safe -(In Progress) Rust binding of [tencent/taitank](https:://github.com/tencent/taitank) provides safe binding to the Taitank Layout Library. +[![License](https://img.shields.io/badge/license-MIT%20License-blue.svg)](https://opensource.org/licenses/MIT) +[![Package version](https://img.shields.io/crates/v/taitank-safe.svg)](https://crates.io/crates/taitank-safe) +[![Workflow](https://github.com/rustq/taitank-safe/actions/workflows/CI.yml/badge.svg)](https://github.com/rustq/taitank-safe/actions) + +Rust binding of [tencent/taitank](https://github.com/tencent/taitank) provides safe binding to the layout library. ## Usage ```toml [dependencies] -taitank_safe = "0.0.1" +taitank_safe = "0.0.6" ``` ```rust use taitank_safe::*; let mut root = node_create(); + set_width(&mut root, 100.0); set_height(&mut root, 100.0); -let mut root_child0 = node_create(); -set_flex_grow(&mut root_child0, 1.0); -set_flex_basis(&mut root_child0, 50.0); -insert_child(&mut root, &mut root_child0, 0); +layout!(&mut root); +``` -let mut root_child1 = node_create(); -set_flex_grow(&mut root_child1, 1.0); -insert_child(&mut root, &mut root_child1, 1); +## Development -layout!(&mut root); -``` \ No newline at end of file +```shell +$ git clone git@github.com:rustq/taitank-safe.git +``` + +```shell +$ cd taitank-safe +``` + +```shell +$ cargo run --example demo +``` + + +## License + +[MIT](https://opensource.org/licenses/MIT) \ No newline at end of file diff --git a/src/lib.rs b/src/lib.rs index 0eea4af..848873b 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -145,7 +145,7 @@ pub fn insert_child(node: &mut TaitankSafeNode, child: &mut TaitankSafeNode, ind /// /// ``` /// let mut root = taitank_safe::node_create(); -/// taitank_safe::set_width(&mut root); +/// taitank_safe::set_width(&mut root, 200.0); /// taitank_safe::do_layout(&mut root, std::f64::NAN, std::f64::NAN, taitank_safe::Direction::LTR); /// ``` pub fn do_layout( diff --git a/src/macros.rs b/src/macros.rs index 3830ae4..88b668d 100644 --- a/src/macros.rs +++ b/src/macros.rs @@ -5,7 +5,7 @@ /// /// ``` /// let mut root = taitank_safe::node_create(); -/// taitank_safe::set_width(&mut root); +/// taitank_safe::set_width(&mut root, 200.0); /// taitank_safe::layout!(&mut root); /// ``` #[macro_export]