method Repr.toRepr
The value as its representation W; called when the type is encoded.
Example:
use std.ser { Repr, DecodeError }
@repr(str)
data Email { text: str }
impl Repr<str> for Email {
fn toRepr() -> str => text.lower()
static fn fromRepr(v: str) -> Email | DecodeError => Email{ text: v }
}
fn main() io {
print(Email{ text: "Ann@Example.org" }.toRepr())
}Output
ann@example.org
fn toRepr() -> WComplexity. as the conversion you write.
Since. 1.0.0-beta
Returns
W
Effects
none declared (pure unless the body says otherwise)
Defined in: std/ser/ser.oxl:183