1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
//! Staquia creates **positions**: short strings that keep the order of a list.
//!
//! Sort the items by their position string and you get the order back; moving an item only changes its own
//! position, so only one row is written to the database per change. It is the Rust version of the
//! [staquia](https://nona9614.github.io/staquia-js/#view=get-started&lang=javascript) JavaScript library: for the same system and operations,
//! both create the same positions.
//!
//! The guides (how positions work, storing them in a database, error handling) are on the
//! [documentation site](https://nona9614.github.io/staquia-js/#view=get-started&lang=rust), which opens with every example in
//! Rust.
//!
//! - [`Staquia`] is a number system that creates [`Position`]s.
//! - [`LexicalList`] keeps the order of your values and their positions in sync.
//!
//! Nothing panics: every operation that can fail returns a [`Result`] with an error enum
//! ([`PositionError`], [`LexicalError`]) that works with `?`.
//!
//! # Example
//!
//! ```
//! use staquia::Staquia;
//!
//! let system = Staquia::create('!', 'a', 'z', 5, 15, 0.15)?;
//!
//! let first = system.start()?; // "mmmmm!"
//! let second = system.next(&first)?; // "mmmmn!"
//! let between = system.core(&first, &second)?; // "mmmmmn"
//!
//! let mut positions = [second.to_string(), first.to_string(), between.to_string()];
//! positions.sort();
//! assert_eq!(positions, ["mmmmm!", "mmmmmn", "mmmmn!"]);
//! # Ok::<(), staquia::Error>(())
//! ```
// `Rejected` gives the values back on failure instead of boxing them
pub use ;
pub use ;
pub use Position;
pub use ;
/// The maximum length of a position (`ln + lz`) of any system.
///
/// Positions live on the stack in an array of this size, so they never allocate.
pub const MAX_LENGTH: usize = 32;
/// Runs the examples of the README as doc tests.
;