#layout #solver #tui #graphics #cassowary

kasuari

A rust layout solver for GUIs, based on the Cassowary algorithm. A fork of the unmaintained cassowary-rs crate with improvments and bug fixes. Kasuari is the indonesian name for the cassowary bird

2 unstable releases

0.4.0-alpha.1 Dec 25, 2024
0.0.0 Oct 4, 2024

#269 in Rendering

Download history 145/week @ 2024-10-04 15/week @ 2024-10-11 3/week @ 2024-10-18 1/week @ 2024-11-08 11/week @ 2024-12-06 3/week @ 2024-12-13 94/week @ 2024-12-20 18/week @ 2024-12-27

120 downloads per month

MIT/Apache

99KB
2K SLoC

Kasuari

crate-badge docs-badge github-badge
license-badge codecov-badge

A Rust implementation of the Cassowary constraint solving algorithm (Badros et. al 2001). It is based heavily on the implementation the C++ Kiwi library. The implementation does however differ in some details.

This library is a fork of Cassowary-rs, by Dylan Ede, which hasn't been maintained since 2018. Kasuari is the Indonesian name for the Cassowary bird.

Cassowary is designed for solving constraints to lay out user interfaces. Constraints typically take the form "this button must line up with this text box", or "this box should try to be 3 times the size of this other box". Its most popular incarnation by far is in Apple's Autolayout system for Mac OS X and iOS user interfaces. UI libraries using the Cassowary algorithm manage to achieve a much more natural approach to specifying UI layouts than traditional approaches like those found in HTML.

This library is a low level interface to the solving algorithm, though it tries to be as convenient as possible. As a result it does not have any intrinsic knowledge of common user interface conventions like rectangular regions or even two dimensions. These abstractions belong in a higher level crate.

For more information, please read the Kasuari API docs.

Getting Started

Add this crate to your Cargo.toml file

cargo add kasuari

Changes from Cassowary-rs

See the CHANGELOG for a full list of changes.

License

Licensed under either of

at your option.

Contribution

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.

Dependencies

~3–4.5MB
~84K SLoC