pub enum Conversion {
Default,
Infallible(Path),
Fallible(FallibleConversion),
}Expand description
How one side of a conversion is performed.
THREE states rather than a path beside a fallible flag, so from-xor-try_from cannot be
represented at all: a declaration that wrote both has no model to land in, and the refusal is a
parse-time report rather than a rule some later pass has to remember to check.
§The verb rule
from BUILDS this projection; into LEAVES it. Relative to the projection the block is
about, never to the domain — one rule across every family, rather than one convention per
family:
| declaration | direction | when |
|---|---|---|
<db>(from | try_from) | domain → row | a write |
<db>(into | try_into) | row → domain | a read |
graphql(input(into | try_into)) | input → domain | |
graphql(output(from | try_from)) | domain → output |
It matches the emitted impls literally: impl From<VideoTrack> for VideoTrackPostgres IS “the
row from the domain”, so the declaration that fills it is the row’s from.
Variants§
Default
Nothing was declared: move the value, or Into::into it when the stored type differs.
Infallible(Path)
from = "…" / into = "…" — a function that cannot fail.
Fallible(FallibleConversion)
try_from = "…" / try_into = "…" — a function returning a Result.