Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create constraint macros that are more ergonomic and concise #195

Open
popematt opened this issue Jul 3, 2023 · 0 comments
Open

Create constraint macros that are more ergonomic and concise #195

popematt opened this issue Jul 3, 2023 · 0 comments

Comments

@popematt
Copy link
Contributor

popematt commented Jul 3, 2023

As a library TODO (if/when we finish the versioning-via-generics refactoring), we should look at making constraint macros that coalesce failure modes and elide all of the .into()s that are currently required at the call site, turning this:

valid_values(
  vec![
    2.into(), 
    ion_rs::Decimal::new(35, -1).into(),
    5e7.into(),
    "hello".to_owned().into(),
    Symbol::from("hi").into(), 
    NumberRange::new_inclusive(2.into(), 3.into()).unwrap().into()
  ]
)

into something more like:

valid_values! [
  2,
  Decimal::new(35, -1), 
  5e7,
  "hello",
  Symbol::from("hi")
  inclusive_number_range! [2, 3]
],

Originally posted by @zslayton in #190 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant