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

DEMO: Pull errors into a separate crate #161

Closed

Conversation

tcharding
Copy link
Member

The only thing used in primitives and hashes from the hex crate is the error types (actually just the HexToArrayError and inner types).

In an effort to stabalise more quickly pull the error types out into a separate crate. Set the version to 1.0.0-alpha.0 and release it already.

@tcharding tcharding force-pushed the 02-21-demo-error-crate branch 2 times, most recently from 0832cd5 to abf5571 Compare February 21, 2025 04:39
The only thing used in `primitives` and `hashes` from the `hex` crate is
the error types (actually just the `HexToArrayError` and inner types).

In an effort to stabalise more quickly pull the error types out into a
separate crate. Set the version to `1.0.0-alpha.0` and release it
already.

impl InvalidCharError {
/// Constructs a new error.
pub fn new(invalid: u8, pos: usize) -> Self { Self { invalid, pos } }
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We definitely cannot have this. It's effectively equivalent to publishing the fields. The only way to get the errors should be by attempting to decode something.

Note also that I was very deliberate in naming in my proposal - instead of stable -errors crate I suggested -unstable crate for two reasons: 1) because it'd also stabilize inherent deserialization functions, so "errors" is misleading 2) to not need to maintain two crates forever for no reason. Once the entire content of -unstable crate is stabilized (by moving to the hex-conservative) we can simply abandon the -unstable crate.

Copy link
Member Author

@tcharding tcharding Feb 24, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok. However we can stick with the 'create stable crate' strategy if we move FromHex into it as well. Demo'd in #162 and #163 (and used in rust-bitcoin: rust-bitcoin/rust-bitcoin#4110).

@apoelstra
Copy link
Member

As per our discussion the other day, I think we should do this on a separate 1.0 branch rather in a separate crate.

@tcharding
Copy link
Member Author

Yep lets have a go at that. Cheers

@tcharding tcharding closed this Feb 22, 2025
@tcharding
Copy link
Member Author

Closing in favour of #162 and #163

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

Successfully merging this pull request may close these issues.

3 participants