Crate taitank

Crate taitank 

Source
Expand description

§Taitank Rust

Taitank 是一个跨平台的轻量级 Flexbox 布局引擎的 Rust 实现。

§特性

  • 完整的 Flexbox 布局支持
  • 高性能布局计算
  • 内存安全(Rust 所有权系统)
  • 类型安全
  • 与 C++ 版本 API 兼容

§快速开始

use taitank::*;

// 创建根节点
let root = node_create();
set_width(&root, 500.0);
set_height(&root, 300.0);
set_flex_direction(&root, FlexDirection::Row);

// 创建子节点
let child = node_create();
set_width(&child, 100.0);
set_height(&child, 100.0);
insert_child(&root, child.clone(), 0);

// 执行布局计算
do_layout(&root, VALUE_UNDEFINED, VALUE_UNDEFINED, TaitankDirection::Ltr, None);

// 获取布局结果
println!("Width: {}, Height: {}", get_width(&root), get_height(&root));

§模块

  • api - 公共 API 接口
  • flex - Flexbox 相关类型和枚举
  • style - 样式管理
  • node - 节点核心实现
  • cache - 布局缓存
  • config - 配置管理

§示例

查看 examples/ 目录获取更多使用示例:

  • basic.rs - 基本使用示例
  • complex.rs - 复杂布局示例
  • absolute_position.rs - 绝对定位示例

Re-exports§

pub use api::*;
pub use cache::*;
pub use config::*;
pub use flex::*;
pub use flexline::*;
pub use node::*;
pub use style::*;
pub use util::*;

Modules§

api
公共 API
cache
config
error
flex
flexline
node
style
util