docs(examples): move constraint-explorer example to examples folder (#1640)

This commit is contained in:
Orhun Parmaksız
2025-02-05 03:23:12 +03:00
committed by GitHub
parent 325f96102a
commit fc70288954
6 changed files with 50 additions and 20 deletions

11
Cargo.lock generated
View File

@@ -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"

View File

@@ -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/).

View 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

View 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
```

View File

@@ -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::{

View File

@@ -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"]