1
0

Add some more docs

This commit is contained in:
Jeff 2024-12-02 02:46:04 -05:00
parent 40bace03f3
commit eb083c2972
2 changed files with 30 additions and 0 deletions

View File

@ -8,6 +8,8 @@
//! The disassembler can be customized with the 'styled' option, which will apply ANSI color codes //! The disassembler can be customized with the 'styled' option, which will apply ANSI color codes
//! to the output. //! to the output.
//! //!
//! If the 'source' option is set, the disassembler will include the source code in the output.
//!
//! # Output //! # Output
//! //!
//! The output of [Disassembler::disassemble] is a string that can be printed to the console or //! The output of [Disassembler::disassemble] is a string that can be printed to the console or

View File

@ -1,4 +1,32 @@
//! The Dust programming language library. //! The Dust programming language library.
//!
//! # Running Programs
//!
//! Dust is easy to embed in another application. The `run` function can be used to run Dust code
//! and get the program's result in a single call.
//!
//! If a program returns a value, it does so with a ConcreteValue. Dust's concrete values are simple
//! and flexible, they are wrappers for familiar Rust types like String, i64 and Vec.
//!
//! If an error occurs, it is returned as a DustError. This error can be used to create a report
//! with source annotations, which should be printed to the user.
//!
//! ## Examples
//!
//! ```rust
//! # use dust_lang::{run, ConcreteValue};
//! let result = run("21 * 2").unwrap();
//!
//! assert_eq!(result, Some(ConcreteValue::Integer(42)));
//! ```
//!
//! ```rust
//! # use dust_lang::{run, DustError};
//! let error = run("21 + wut").unwrap_err();
//! let report = error.report();
//!
//! println!("{}", report);
//! ```
pub mod chunk; pub mod chunk;
pub mod compiler; pub mod compiler;