[−][src]Crate vf_rs
A set of ValueFlows structs and utils auto-generated from the JSON schema.
The structs defined use the same names as the title
field in the
restecpive schema. Enums are also defined for enum types, for instance the
Action struct's label
field has an ActionLabel type, which is an enum that
has the enum values from the schema defined in it.
The structs exported have builder structs defined for them using the
wonderful derive_builder crate. So Action
also has a corresponding
ActionBuilder
struct. Builder structs use the "owned" pattern, meaning the
builder methods consume the builder and return a new instance on each call.
Given an existing Action
struct instance, you can call
myaction.into_builder()
to convert (consume) it into an ActionBuilder
,
which makes immutable updates fairly easy.
use vf_rs::action; // build a new action with the builder pattern let action = action::ActionBuilder::default() .label(action::Label::TransferAllRights) .resource_effect(action::ResourceEffect::Increment) .build().unwrap(); // create a new action with a different label let new_action = action.into_builder() .label(action::Label::TransferCustody) .build().unwrap();