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
Add the MapOwned trait and the Once<T>
userdata type
#693
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice improvements! The comments are minor, fix if you want.
bors try
impl Display for ValueTaken { | ||
#[inline] | ||
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { | ||
write!(f, "this object can only be used once") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Capitalize the first char for consistency with the other Display
impls in the file. Also, the text alludes to the object having been used already. Perhaps be more direct? "This object has already been used once."
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changed to this object has already been used once
. According to the Rust API Guidelines, error messages should actually be lower case without trailing punctuation: https://rust-lang.github.io/api-guidelines/interoperability.html#error-types-are-meaningful-and-well-behaved-c-good-err
We can change the other Display
impls in another PR.
} | ||
|
||
ok | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tests! <3
tryBuild succeeded: |
This adds support for exporting methods that take ownership of `self`. `Once<T>` is a userdata wrapper that uses atomic compare-exchange to allow taking ownership safely once.
Updated and should be ready! bors r+ |
693: Add the MapOwned trait and the `Once<T>` userdata type r=toasteater a=toasteater This adds support for exporting methods that take ownership of `self`. `Once<T>` is a userdata wrapper that uses atomic compare-exchange to allow taking ownership safely once. Co-authored-by: toasteater <48371905+toasteater@users.noreply.github.com>
Build failed: |
Failed due to new clippy lints fixed in #703 bors retry |
Build succeeded: |
This adds support for exporting methods that take ownership of
self
.Once<T>
is a userdata wrapper that uses atomic compare-exchange to allow taking ownership safely once.