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

bespoke traits that could be replaced with standard traits #330

Open
2 of 7 tasks
danieleades opened this issue Nov 14, 2022 · 7 comments
Open
2 of 7 tasks

bespoke traits that could be replaced with standard traits #330

danieleades opened this issue Nov 14, 2022 · 7 comments

Comments

@danieleades
Copy link
Contributor

danieleades commented Nov 14, 2022

i see some bespoke traits which are similar to standard library traits, I was hoping you could comment.

For example, there are ToU16 and FromU16 traits, which seem like they would map precisely to the standard library traits Into<u16> and TryFrom<u16, Error=capnp::NotInSchema> respectively. Is there a reason for not using the standard traits?

@danieleades
Copy link
Contributor Author

incidentally, if i were to change the code generation for files like capnpc/src/schema_capnp.rs, how would I regenerate those files?

@dwrensha
Copy link
Member

Using the standard Into and TryFrom traits makes sense to me. Probably ToU16 and FromU16 were created before the standard traits existed. Note, though, that replacing them would be a breaking change. So I suppose that's another thing that can go into the 0.16.0 release, whenever we do that.

@dwrensha
Copy link
Member

incidentally, if i were to change the code generation for files like capnpc/src/schema_capnp.rs, how would I regenerate those files?

  1. Get the the corresponding .capnp files from the main capnproto repo:
    https://github.com/capnproto/capnproto/blob/master/c%2B%2B/src/capnp/schema.capnp
  2. build capnpc-rust with cargo build -p capnpc --release
  3. run capnp compile -o./target/release/capnpc-rust [schema file]

@danieleades
Copy link
Contributor Author

starting to collect a few breaking changes. how do you keep track? will you just leave this PR open?

@danieleades
Copy link
Contributor Author

starting to collect a few breaking changes. how do you keep track? will you just leave the PR open?

@dwrensha
Copy link
Member

We could add a "version bump" label for issues and PRs.

@danieleades
Copy link
Contributor Author

@dwrensha I notice there's a huge number of structs with new_default constructors. Is there a reason for using this pattern over the built in Default trait?

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

2 participants