Supertrait seal {send,receive}::..State traits#994
Merged
DanGould merged 1 commit intopayjoin:masterfrom Aug 28, 2025
Merged
Conversation
Collaborator
Pull Request Test Coverage Report for Build 17305417442Details
💛 - Coveralls |
2e3c891 to
59e5cb3
Compare
Contributor
Author
|
Pls @arminsabouri my 1.0 famili depends on it |
These traits are in the public API but not for downstream users to implement. Close payjoin#747
59e5cb3 to
845025d
Compare
arminsabouri
approved these changes
Aug 28, 2025
Collaborator
arminsabouri
left a comment
There was a problem hiding this comment.
tACK
Can confirm you cannot impl State outside the crate
struct x {};
impl payjoin::receive::v2::State for x {};Results in
the trait bound `x: payjoin::receive::v2::sealed::State` is not satisfied
the following other types implement trait `payjoin::receive::v2::sealed::State`:
payjoin::receive::v2::Initialized
payjoin::receive::v2::MaybeInputsOwned
payjoin::receive::v2::MaybeInputsSeen
payjoin::receive::v2::OutputsUnknown
payjoin::receive::v2::PayjoinProposal
payjoin::receive::v2::ProvisionalProposal
payjoin::receive::v2::UncheckedProposal
payjoin::receive::v2::WantsFeeRange
and 2 others
`State` is a "sealed trait", because to implement it you also need to implement `payjoin::receive::v2::sealed::State`, which is not accessible; this is usually done to force you to use one of the provided types that already implement it
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
These traits are in the public API but not for downstream users to implement. Close #747
Here's an article on what the heck that means: https://predr.ag/blog/definitive-guide-to-sealed-traits-in-rust/
Pull Request Checklist
Please confirm the following before requesting review: