S0074: request needs explicit initial value
Generated from rellum-diagnostics/src/db.rs.
Explanation
A request binding must have a stored value before the first request result arrives. The compiler can synthesize zero values for simple scalar and Option storage, but Move types such as String and complex records need an explicit initial clause.
Common causes
- storing String request results without initial =>
- storing a record, array, or other Move type without an initial value
- using handlers that establish a stored type the compiler cannot zero-initialize
Canonical fixes
- add an explicit initial clause
Before:
greeting ~ request env!("GREETING")
on some(v) => v
on none => ""
After:
greeting ~ request env!("GREETING")
on some(v) => v
on none => ""
initial => ""
- change the stored type to one with an inferred zero value
Code example
greeting ~ request env!("GREETING")
on some(v) => v
on none => ""