Skip to content

Commit

Permalink
Fix doc-tests.
Browse files Browse the repository at this point in the history
  • Loading branch information
schungx committed May 17, 2024
1 parent 5b3445d commit 06c2dfa
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/api/events.rs
Original file line number Diff line number Diff line change
Expand Up @@ -356,6 +356,7 @@ impl Engine {
/// ```
/// # fn main() -> Result<(), Box<rhai::EvalAltResult>> {
/// # use rhai::{Engine, Dynamic, EvalAltResult, Position};
/// # use std::convert::TryInto;
/// let mut engine = Engine::new();
///
/// engine.on_invalid_array_index(|arr, index, _| match index
Expand All @@ -365,7 +366,7 @@ impl Engine {
/// arr.push((42_i64).into());
/// // Return a mutable reference to an element
/// let value_ref = arr.last_mut().unwrap();
/// Ok(value_ref.into())
/// value_ref.try_into()
/// }
/// 100 => {
/// let value = Dynamic::from(100_i64);
Expand Down Expand Up @@ -433,6 +434,7 @@ impl Engine {
/// ```
/// # fn main() -> Result<(), Box<rhai::EvalAltResult>> {
/// # use rhai::{Engine, Dynamic, EvalAltResult, Position};
/// # use std::convert::TryInto;
/// let mut engine = Engine::new();
///
/// engine.on_map_missing_property(|map, prop, _| match prop
Expand All @@ -442,7 +444,7 @@ impl Engine {
/// map.insert("y".into(), (42_i64).into());
/// // Return a mutable reference to an element
/// let value_ref = map.get_mut("y").unwrap();
/// Ok(value_ref.into())
/// value_ref.try_into()
/// }
/// "z" => {
/// // Return a temporary value (not a reference)
Expand Down

0 comments on commit 06c2dfa

Please sign in to comment.