Skip to content

ParamsSpec: Store Mapping Functions Separately #156

@azriel91

Description

@azriel91

Enables the developer to not have to pass in params specs for items that had mapping functions.

Currently ParamsSpec and related types -- ParamsSpecFieldless, ValueSpec, FieldWiseSpec (generated by proc macro) -- hold MappingFns within their type.

This forces users to respecify the params specs with mapping functions in subsequent CmdCtx::builder_* instantiation.

This change is to:

  1. Get developers to instantiate a Map<MappingFnK, Box<dyn MappingFn>>, and pass that to CmdCtx::builder_*.
  2. ParamsSpec and related types will hold the MappingFnK.
  3. Developers should define the MappingFnK, an all-unit-variant enum with sensible names to identify the mapping function.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Projects

Status

Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions