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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
//! A crate for procedurally generating content using L-systems.
//!
//! **NOTE:** this crate is still under early development, and might change rapidly.
//! The next released version will likely have breaking changes.
//!
//! # Introduction
//!
//! This crate currently supports producing strings using *context-free* and
//! *stochastic* [L-Systems][wiki].
//!
//! The [system module](system) contains the primary tools for defining
//! and running these grammars. As a convenience, the [`geometry`] module
//! contains types for easily handling the interpretation of the grammar's output
//! in a 2D space. Note that the geometry tools are not meant to be complete or high performance —
//! it's meant to only be utilitarian.
//!
//! # Parsing and Derivation
//!
//! The easiest way to parse:
//!
//! ```
//! use rusty_systems::prelude::*;
//! use rusty_systems::parser;
//!
//! let system = System::new();
//! system.parse_production("CompanyName -> Surname Surname").unwrap();
//!
//! let starting_axiom = parser::parse_prod_string("CompanyName").unwrap();
//! let result = system.derive(starting_axiom, RunSettings::default()).unwrap();
//!
//! println!("The resulting string is:\n{result}");
//!
//! ```
//!
//! If you would like to parse without using a [`System`] instance,
//! you can use the following underlying functions:
//!
//! * [`parser::parse_production`] to parse individual productions.
//!
//! See [`parser`] for more information, and for generic parsing
//! functions that do not need you to use [`System`].
//!
//! # Features
//!
//! Some features that you might find useful:
//!
//! * **Some support for interpreting L-Systems as defined in [the Algorithmic Beauty of Plants (ABOP)][abop].**
//! See the [abop module](interpretation::abop) documentation.
//! * **Some native, limited support for geometric primitives.**
//! See the [geometry module](geometry). This is not meant as a replacement for libraries
//! such as [nalgebra][nalgebra], just as something convenient to use.
//! * **Native support for creating and outputting SVGs.**
//! See the [svg module](interpretation::svg).
//! * **A command line app, `lsystem`, for creating SVGs of systems from ABOP.**
//! You can read about using this tool [here][lsystem-tool]
//!
//! # Examples
//!
//! The crate's example directory has various examples:
//!
//! * [Vector graphics plant][skia-plant]
//!
//! This example uses two rules to produce a small plant. The symbols
//! are interpreted using a classic [logo turtle][logo-turtle] interpretation
//! to produce vector graphics. While the example uses [tiny skia][tiny-skia],
//! this can be replaced with any vector graphic library.
//!
//! If you clone the code repository, you can run this using:
//!
//! ```cargo run --example skia-plant ```
//!
//! # Learn more about L-Systems
//!
//! If you would like to learn more about L-Systems, the original *Algorithmic Beauty of Plants*
//! book by Prusinkiewicz and Lindenmayer is [available for free, online][abop].
//!
//! # Code repository, license, and versioning.
//!
//! This crate has a website available at
//! [https://theriver.github.io/rusty-systems/][website].
//!
//! The code repository is hosted on [GitHub](https://github.com/TheRiver/rusty-systems/) and
//! is distributed under an [MIT license][license]. A [changelog][changelog] is also available.
//!
//! This crate versioning uses [semantic versioning][semver].
//!
//! [wiki]: https://en.wikipedia.org/wiki/L-system
//! [abop]: http://algorithmicbotany.org/papers/#abop
//! [skia-plant]: https://github.com/TheRiver/rusty-systems/blob/main/examples/skia-plant/main.rs
//! [logo-turtle]: https://en.wikipedia.org/wiki/Logo_(programming_language)
//! [tiny-skia]: https://github.com/RazrFalcon/tiny-skia
//! [semver]: https://semver.org/
//! [docs]: https://docs.rs/rusty-systems/latest/rusty_systems/
//! [license]: https://github.com/TheRiver/rusty-systems/blob/main/LICENSE
//! [changelog]: https://github.com/TheRiver/rusty-systems/blob/main/CHANGELOG.md
//! [website]: https://theriver.github.io/rusty-systems/
//! [nalgebra]: https://nalgebra.org/
//! [lsystem-tool]: https://theriver.github.io/rusty-systems/lsystem/
/// Some commonly used members of the crate re-exported for easy access.
///
/// Use it like so:
///
/// ```rust
/// use rusty_systems::prelude::*;
/// ```
use *;
/// A result type for functions that can return errors.
pub type Result<T> = Result;