Chapter 6: Advanced Akari operations & templating

Akari Object

Akari Object, as discussed in Chapter 3, is a Json like data structure. This also leads to the result of that Akari Object is never type safe

Akari Object is able to hold 5 types of value, they are: numerical, boolean, String, List and Object

You may extract the value from Akari by using match or if let, just like any other Rust enums. You may also use a shorthand, just append the data type after the value, such as

let a = object!(3); 
assert!(a.numerical, 3.0); // Akari stores numericals as float 
assert!(a.boolean, true); // Akari applies auto conversion, if != 0.0 then return true 

Akari template

Note: Some grammar does not implemented in 0.2.2 (The version used in default in Starberry 0.4.7), but you may update this manually

Extend, Insert and Blocks

Accessing dictionaries and lists