docs(examples): move constraint-explorer example to examples folder (#1640)
This commit is contained in:
11
Cargo.lock
generated
11
Cargo.lock
generated
@@ -583,6 +583,17 @@ dependencies = [
|
||||
"static_assertions",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "constraint-explorer"
|
||||
version = "0.0.0"
|
||||
dependencies = [
|
||||
"color-eyre",
|
||||
"crossterm",
|
||||
"itertools 0.13.0",
|
||||
"ratatui",
|
||||
"strum",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "core-foundation"
|
||||
version = "0.10.0"
|
||||
|
||||
@@ -65,6 +65,10 @@ Shows how to render a canvas with different shapes. [Source](./apps/canvas/).
|
||||
|
||||
This example shows the full range of RGB colors in an animation. [Source](./apps/colors-rgb/).
|
||||
|
||||
## Constraint Explorer demo
|
||||
|
||||
This interactive example shows how different constraints can be used to layout widgets. [Source](./apps/constraint-explorer/).
|
||||
|
||||
## Hello World demo
|
||||
|
||||
This example shows how to create a simple TUI with a text. [Source](./apps/hello-world/).
|
||||
|
||||
16
examples/apps/constraint-explorer/Cargo.toml
Normal file
16
examples/apps/constraint-explorer/Cargo.toml
Normal file
@@ -0,0 +1,16 @@
|
||||
[package]
|
||||
name = "constraint-explorer"
|
||||
publish = false
|
||||
license.workspace = true
|
||||
edition.workspace = true
|
||||
rust-version.workspace = true
|
||||
|
||||
[dependencies]
|
||||
color-eyre.workspace = true
|
||||
crossterm.workspace = true
|
||||
itertools.workspace = true
|
||||
ratatui.workspace = true
|
||||
strum.workspace = true
|
||||
|
||||
[lints]
|
||||
workspace = true
|
||||
9
examples/apps/constraint-explorer/README.md
Normal file
9
examples/apps/constraint-explorer/README.md
Normal file
@@ -0,0 +1,9 @@
|
||||
# Constraint explorer demo
|
||||
|
||||
This interactive example shows how different constraints can be used to layout widgets.
|
||||
|
||||
To run this demo:
|
||||
|
||||
```shell
|
||||
cargo run -p constraint-explorer
|
||||
```
|
||||
@@ -1,18 +1,13 @@
|
||||
//! # [Ratatui] Constraint explorer example
|
||||
//!
|
||||
//! The latest version of this example is available in the [examples] folder in the repository.
|
||||
//!
|
||||
//! Please note that the examples are designed to be run against the `main` branch of the Github
|
||||
//! repository. This means that you may not be able to compile with the latest release version on
|
||||
//! crates.io, or the one that you have installed locally.
|
||||
//!
|
||||
//! See the [examples readme] for more information on finding examples that match the version of the
|
||||
//! library you are using.
|
||||
//!
|
||||
//! [Ratatui]: https://github.com/ratatui/ratatui
|
||||
//! [examples]: https://github.com/ratatui/ratatui/blob/main/examples
|
||||
//! [examples readme]: https://github.com/ratatui/ratatui/blob/main/examples/README.md
|
||||
|
||||
/// A Ratatui example that demonstrates how different layout constraints work.
|
||||
///
|
||||
/// It also supports swapping constraints, adding and removing blocks, and changing the spacing
|
||||
/// between blocks.
|
||||
///
|
||||
/// This example runs with the Ratatui library code in the branch that you are currently
|
||||
/// reading. See the [`latest`] branch for the code which works with the most recent Ratatui
|
||||
/// release.
|
||||
///
|
||||
/// [`latest`]: https://github.com/ratatui/ratatui/tree/latest
|
||||
use color_eyre::Result;
|
||||
use itertools::Itertools;
|
||||
use ratatui::{
|
||||
@@ -142,11 +142,6 @@ bench = false
|
||||
name = "main"
|
||||
harness = false
|
||||
|
||||
[[example]]
|
||||
name = "constraint-explorer"
|
||||
required-features = ["crossterm"]
|
||||
doc-scrape-examples = true
|
||||
|
||||
[[example]]
|
||||
name = "constraints"
|
||||
required-features = ["crossterm"]
|
||||
|
||||
Reference in New Issue
Block a user