facet-generate ยท

Reflect types annotated with #[Facet] into Java, Swift, and TypeScript.
Notes:
- Currently, struct and enum renaming is not fully implemented and probably requires an upstream PR to facet.
- Vendors
serde-reflectandserde-generate, which we are evolving to support additional features and more idiomatic foreign type generation with additional extension points. - One way to generate code is to install
serde-generate-bin(cargo install serde-generate-bin), and run that on the yaml generated (e.g.serdegen --language swift --with-runtimes serde bincode --module-name Test test.yaml).
Usage
use Facet;
let registry = ;
assert_yaml_snapshot!;
Arbitrary facet attributes
Struct and Enum renaming doesn't use #[facet(rename = "Effect")], as facet doesn't seem to pass it through (yet?). So instead, for now, we use an arbitrary ShapeAttribute (name instead of rename), like this:
In order to specify BYTES in the IR (for Vec<u8> and &'a [u8]), we can use the #[facet(bytes)] attribute: