Interop
Stof was created for interoperability and extensibility.
Example: YAML in, JSON out
# server.yaml
server:
port: 4000
address: "my-server.com"
memory: 3000
ttl: 5000// types.stof
#[type]
Server: {
#[schema((target_val: int): bool => target_val > 1024 && target_val <= 65536)]
int port: 8080
#[schema((target_val: str): bool => target_val != "")]
str! address: "localhost"
/// 3000 from YAML becomes 3000MB β auto-converted to GiB for display
#[schema((target_val: MiB): bool => target_val >= 512MB)]
MiB memory: 1GiB
/// 5000 from YAML becomes 5000ms β compared against 1s automatically
#[schema((target_val: ms): bool => target_val >= 1s)]
ms ttl: 30s
fn url() -> str {
`https://${self.address}:${self.port}`
}
}Supported formats
Format
Read/Parse
Write/Export
What's next?
Last updated