Write docs

This commit is contained in:
Jeff 2023-08-28 09:51:04 -04:00
parent 37604cc8f0
commit cf544d3c7e
2 changed files with 7 additions and 3 deletions

View File

@ -1,3 +1,5 @@
//! The top level of Dust's API with functions in interpret Dust code.
use crate::{token, tree, Result, Value, VariableMap}; use crate::{token, tree, Result, Value, VariableMap};
/// Evaluate the given expression string. /// Evaluate the given expression string.
@ -27,8 +29,6 @@ pub fn eval(string: &str) -> Result<Value> {
/// context.set_value("three".into(), 3.into()).unwrap(); // Do proper error handling here /// context.set_value("three".into(), 3.into()).unwrap(); // Do proper error handling here
/// assert_eq!(eval_with_context("one + two + three", &mut context), Ok(Value::from(6))); /// assert_eq!(eval_with_context("one + two + three", &mut context), Ok(Value::from(6)));
/// ``` /// ```
///
/// *See the [crate doc](index.html) for more examples and explanations of the expression format.*
pub fn eval_with_context(input: &str, context: &mut VariableMap) -> Result<Value> { pub fn eval_with_context(input: &str, context: &mut VariableMap) -> Result<Value> {
let without_comments = input let without_comments = input
.lines() .lines()

View File

@ -1,4 +1,8 @@
#![doc = include_str!("../README.md")] //! The Dust library is used to implement the Dust language, `src/main.rs` implements the command
//! line binary.
//!
//! Using this library is simple and straightforward, see the [inferface] module for instructions on
//! interpreting Dust code. Most of the language's features are implemented in the [tools] module.
#![forbid(unsafe_code)] #![forbid(unsafe_code)]
pub use crate::{ pub use crate::{