diff options
Diffstat (limited to 'serde_v8')
-rw-r--r-- | serde_v8/README.md | 6 | ||||
-rw-r--r-- | serde_v8/serializable.rs | 2 |
2 files changed, 4 insertions, 4 deletions
diff --git a/serde_v8/README.md b/serde_v8/README.md index 2a9169681..d36f69375 100644 --- a/serde_v8/README.md +++ b/serde_v8/README.md @@ -29,9 +29,9 @@ nested HashMaps), so when writing ops we recommend directly using rust structs/tuples or primitives, since mapping to `serde_json::Value` will add extra overhead and result in slower ops. -I also recommend avoiding unecessary "wrappers", if your op takes a single-keyed -struct, consider unwrapping that as a plain value unless you plan to add fields -in the near-future. +I also recommend avoiding unnecessary "wrappers", if your op takes a +single-keyed struct, consider unwrapping that as a plain value unless you plan +to add fields in the near-future. Instead of returning "nothing" via `Ok(json!({}))`, change your return type to rust's unit type `()` and returning `Ok(())`, `serde_v8` will efficiently encode diff --git a/serde_v8/serializable.rs b/serde_v8/serializable.rs index 36a8bc27b..7380ab5a7 100644 --- a/serde_v8/serializable.rs +++ b/serde_v8/serializable.rs @@ -29,7 +29,7 @@ impl<T: serde::Serialize> Serializable for T { } /// SerializablePkg exists to provide a fast path for op returns, -/// allowing them to avoid boxing primtives (ints/floats/bool/unit/...) +/// allowing them to avoid boxing primitives (ints/floats/bool/unit/...) pub enum SerializablePkg { Primitive(Primitive), Serializable(Box<dyn Serializable>), |