An optional value that records presence explicitly.
Signature
enum Opt[T] { Some(T), None }Match both Some and None before using an optional result.
Cases
Some(T)- Contains a present value of T.
None- Records that no value is present.
Examples
Match an optional value
Both cases make absence explicit.
main.kj
Loading…Drag to orbit · select to inspect
0 entities
Scene controls
Results
Loading the language runtime…
Output 0
No output.
State
Compile source to inspect its values.
TraceNo execution yet
- Executed source spans appear here.
Expected output
4
Rust definition
Value::Enum with the concrete Opt[T] type and checked case payload.
View Rust documentation →Support: runtime