From 2a760eb44b09f1af8ecd5c3c951576f237809f20 Mon Sep 17 00:00:00 2001 From: Stephen Chung Date: Tue, 24 Aug 2021 12:04:53 +0800 Subject: [PATCH] Update doc-comments. --- src/engine_api.rs | 34 ++++++++++------------------------ 1 file changed, 10 insertions(+), 24 deletions(-) diff --git a/src/engine_api.rs b/src/engine_api.rs index 7156a2a1..e8f4a888 100644 --- a/src/engine_api.rs +++ b/src/engine_api.rs @@ -21,7 +21,6 @@ use crate::Array; #[cfg(not(feature = "no_object"))] use crate::Map; -/// Engine public API impl Engine { /// Register a custom function with the [`Engine`]. /// @@ -193,9 +192,8 @@ impl Engine { /// } /// /// impl TestStruct { - /// fn new() -> Self { Self { field: 1 } } - /// - /// fn update(&mut self, offset: i64) { self.field += offset; } + /// fn new() -> Self { Self { field: 1 } } + /// fn update(&mut self, offset: i64) { self.field += offset; } /// } /// /// # fn main() -> Result<(), Box> { @@ -294,8 +292,7 @@ impl Engine { /// } /// /// impl TestStruct { - /// fn new() -> Self { Self { field: 1 } } - /// + /// fn new() -> Self { Self { field: 1 } } /// // Even a getter must start with `&mut self` and not `&self`. /// fn get_field(&mut self) -> i64 { self.field } /// } @@ -343,7 +340,6 @@ impl Engine { /// /// impl TestStruct { /// fn new() -> Self { Self { field: 1 } } - /// /// // Even a getter must start with `&mut self` and not `&self`. /// fn get_field(&mut self) -> Result> { /// Ok(self.field) @@ -386,9 +382,8 @@ impl Engine { /// } /// /// impl TestStruct { - /// fn new() -> Self { Self { field: 1 } } - /// - /// fn set_field(&mut self, new_val: i64) { self.field = new_val; } + /// fn new() -> Self { Self { field: 1 } } + /// fn set_field(&mut self, new_val: i64) { self.field = new_val; } /// } /// /// # fn main() -> Result<(), Box> { @@ -436,7 +431,6 @@ impl Engine { /// /// impl TestStruct { /// fn new() -> Self { Self { field: 1 } } - /// /// fn set_field(&mut self, new_val: i64) -> Result<(), Box> { /// self.field = new_val; /// Ok(()) @@ -486,12 +480,10 @@ impl Engine { /// } /// /// impl TestStruct { - /// fn new() -> Self { Self { field: 1 } } - /// + /// fn new() -> Self { Self { field: 1 } } /// // Even a getter must start with `&mut self` and not `&self`. - /// fn get_field(&mut self) -> i64 { self.field } - /// - /// fn set_field(&mut self, new_val: i64) { self.field = new_val; } + /// fn get_field(&mut self) -> i64 { self.field } + /// fn set_field(&mut self, new_val: i64) { self.field = new_val; } /// } /// /// # fn main() -> Result<(), Box> { @@ -543,7 +535,6 @@ impl Engine { /// /// impl TestStruct { /// fn new() -> Self { Self { fields: vec![1, 2, 3, 4, 5] } } - /// /// // Even a getter must start with `&mut self` and not `&self`. /// fn get_field(&mut self, index: i64) -> i64 { self.fields[index as usize] } /// } @@ -617,7 +608,6 @@ impl Engine { /// /// impl TestStruct { /// fn new() -> Self { Self { fields: vec![1, 2, 3, 4, 5] } } - /// /// // Even a getter must start with `&mut self` and not `&self`. /// fn get_field(&mut self, index: i64) -> Result> { /// Ok(self.fields[index as usize]) @@ -691,7 +681,6 @@ impl Engine { /// /// impl TestStruct { /// fn new() -> Self { Self { fields: vec![1, 2, 3, 4, 5] } } - /// /// fn set_field(&mut self, index: i64, value: i64) { self.fields[index as usize] = value; } /// } /// @@ -765,7 +754,6 @@ impl Engine { /// /// impl TestStruct { /// fn new() -> Self { Self { fields: vec![1, 2, 3, 4, 5] } } - /// /// fn set_field(&mut self, index: i64, value: i64) -> Result<(), Box> { /// self.fields[index as usize] = value; /// Ok(()) @@ -841,11 +829,9 @@ impl Engine { /// } /// /// impl TestStruct { - /// fn new() -> Self { Self { fields: vec![1, 2, 3, 4, 5] } } - /// + /// fn new() -> Self { Self { fields: vec![1, 2, 3, 4, 5] } } /// // Even a getter must start with `&mut self` and not `&self`. - /// fn get_field(&mut self, index: i64) -> i64 { self.fields[index as usize] } - /// + /// fn get_field(&mut self, index: i64) -> i64 { self.fields[index as usize] } /// fn set_field(&mut self, index: i64, value: i64) { self.fields[index as usize] = value; } /// } ///