smallish
Lightweight, no-std, no-alloc syntax for configuration and scripting.
Deserializing
smallish is designed to be used with serde to parse lists of short instructions. For example, you can put your instructions inside an enumeration, and then parse them with from_str.
use ;
let source = r#"
Print msg="hello" # comments work
SetMinMax 20 60
"#;
let instrs: = from_str.unwrap;
assert_eq!;
It is also possible to use from_slice if your source is a slice of bytes. Both of these methods have a fixed recursion depth. If your data type is very deeply nested, you should use Deserializer directly.
Syntax
The details of smallish syntax are outlined in the syntax module documentation. This also includes many examples.
smallish comes in a few slightly different Flavors.
Special Types
There are a few special types that modify how a value is deserialized by smallish, for example by annotating it with source location, or opting out of string escapes for guaranteed zero-copy behavior. These types are documented in the types module.
Feature Flags
These features are enabled by default:
custom-error-messagesattaches a small space for custom error messages to the deserialization error type. This costs a small amount of space, but increases the usefulness of a few error messages generated by serde.
These features are optional:
defmtderivesdefmt::Formatfor all types, and usesdefmt::panic!and friends instead of their standard counterparts.
License
Licensed under the MIT license. Unless stated otherwise, any contributions to this work will also be licensed this way, with no additional terms or conditions.