Skip to content

Commit

Permalink
feat(flex): flex reading api should be immutable borrow api
Browse files Browse the repository at this point in the history
  • Loading branch information
meloalright committed Nov 16, 2024
1 parent 857c8dd commit d37ebfb
Show file tree
Hide file tree
Showing 9 changed files with 1,289 additions and 1,289 deletions.
Empty file added examples/async.rs
Empty file.
8 changes: 4 additions & 4 deletions include/safe.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@ void set_align_content(std::unique_ptr<TaitankSafeNode> & node, int align_conten
void set_justify_content(std::unique_ptr<TaitankSafeNode> & node, int justify_content);
void insert_child(std::unique_ptr<TaitankSafeNode> & node, std::unique_ptr<TaitankSafeNode> & child, int index);
void do_layout(std::unique_ptr<TaitankSafeNode> & node, double parent_width, double parent_height, int direction);
double get_width(std::unique_ptr<TaitankSafeNode> & node);
double get_height(std::unique_ptr<TaitankSafeNode> & node);
double get_left(std::unique_ptr<TaitankSafeNode> & node);
double get_top(std::unique_ptr<TaitankSafeNode> & node);
double get_width(std::unique_ptr<TaitankSafeNode> const & node);
double get_height(std::unique_ptr<TaitankSafeNode> const & node);
double get_left(std::unique_ptr<TaitankSafeNode> const & node);
double get_top(std::unique_ptr<TaitankSafeNode> const & node);
void print(std::unique_ptr<TaitankSafeNode> const & node);
16 changes: 8 additions & 8 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -139,15 +139,15 @@ pub fn do_layout(
direction as i32,
);
}
pub fn get_width(node: &mut TaitankSafeNode) -> f64 {
ffi::get_width(&mut node.unique_ptr)
pub fn get_width(node: &TaitankSafeNode) -> f64 {
ffi::get_width(&node.unique_ptr)
}
pub fn get_height(node: &mut TaitankSafeNode) -> f64 {
ffi::get_height(&mut node.unique_ptr)
pub fn get_height(node: &TaitankSafeNode) -> f64 {
ffi::get_height(&node.unique_ptr)
}
pub fn get_left(node: &mut TaitankSafeNode) -> f64 {
ffi::get_left(&mut node.unique_ptr)
pub fn get_left(node: &TaitankSafeNode) -> f64 {
ffi::get_left(&node.unique_ptr)
}
pub fn get_top(node: &mut TaitankSafeNode) -> f64 {
ffi::get_top(&mut node.unique_ptr)
pub fn get_top(node: &TaitankSafeNode) -> f64 {
ffi::get_top(&node.unique_ptr)
}
8 changes: 4 additions & 4 deletions src/safe.cc
Original file line number Diff line number Diff line change
Expand Up @@ -295,19 +295,19 @@ void set_justify_content(std::unique_ptr<TaitankSafeNode> & node, int justify) {
}
}

double get_width(std::unique_ptr<TaitankSafeNode> & node) {
double get_width(std::unique_ptr<TaitankSafeNode> const & node) {
return taitank::GetWidth(node->ptr);
}

double get_height(std::unique_ptr<TaitankSafeNode> & node) {
double get_height(std::unique_ptr<TaitankSafeNode> const & node) {
return taitank::GetHeight(node->ptr);
}

double get_left(std::unique_ptr<TaitankSafeNode> & node) {
double get_left(std::unique_ptr<TaitankSafeNode> const & node) {
return taitank::GetLeft(node->ptr);
}

double get_top(std::unique_ptr<TaitankSafeNode> & node) {
double get_top(std::unique_ptr<TaitankSafeNode> const & node) {
return taitank::GetTop(node->ptr);
}

Expand Down
8 changes: 4 additions & 4 deletions src/safe.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,10 @@ pub mod ffi {
parent_height: f64,
direction: i32,
);
fn get_width(node: &mut UniquePtr<TaitankSafeNode>) -> f64;
fn get_height(node: &mut UniquePtr<TaitankSafeNode>) -> f64;
fn get_left(node: &mut UniquePtr<TaitankSafeNode>) -> f64;
fn get_top(node: &mut UniquePtr<TaitankSafeNode>) -> f64;
fn get_width(node: &UniquePtr<TaitankSafeNode>) -> f64;
fn get_height(node: &UniquePtr<TaitankSafeNode>) -> f64;
fn get_left(node: &UniquePtr<TaitankSafeNode>) -> f64;
fn get_top(node: &UniquePtr<TaitankSafeNode>) -> f64;
fn print(node: &UniquePtr<TaitankSafeNode>);
}
}
Loading

0 comments on commit d37ebfb

Please sign in to comment.