-
Notifications
You must be signed in to change notification settings - Fork 12.7k
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
improve BitAnd
trait documentation
#35993
Conversation
r? @aturon (rust_highfive has picked a reviewer for you, use r? to override) |
/// type Output = Self; | ||
/// | ||
/// fn bitand(self, Scalar(rhs): Self) -> Self { | ||
/// let Scalar(lhs) = self; |
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.
Could you some comments here (at least to explain a bit about lhs
and rhs
, I think some people don't know what this is).
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.
How's this?
9769a7f
to
a9e9928
Compare
This pull request is based on the discussion in PR rust-lang#35927. Add a module-level note that `&&` and `||` are short-circuiting operators and not overloadable. Add a simple `Scalar` example that lifts the `&` operator to a trivial struct tuple. Make `BooleanVector` a struct tuple. Derive `PartialEq` for `BooleanVector` instead of implementing it. Adds a `fn main` wrapper so that the example can integrate with Rust Playground. simplified bitand expression add a comment explaining what "rhs" means
8a5f483
to
e2d9974
Compare
@bors: r+ rollup |
📌 Commit e2d9974 has been approved by |
…=GuillaumeGomez improve `BitAnd` trait documentation This pull request is based on the discussion in PR rust-lang#35927. Add a module-level note that `&&` and `||` are short-circuiting operators and not overloadable. Add a simple `Scalar` example that lifts the `&` operator to a trivial struct tuple. Make `BooleanVector` a struct tuple. Derive `PartialEq` for `BooleanVector` instead of implementing it. Adds a `fn main` wrapper so that the example can integrate with Rust Playground.
⌛ Testing commit e2d9974 with merge 01a010a... |
💔 Test failed - auto-mac-64-opt-rustbuild |
@bors retry |
…=GuillaumeGomez improve `BitAnd` trait documentation This pull request is based on the discussion in PR rust-lang#35927. Add a module-level note that `&&` and `||` are short-circuiting operators and not overloadable. Add a simple `Scalar` example that lifts the `&` operator to a trivial struct tuple. Make `BooleanVector` a struct tuple. Derive `PartialEq` for `BooleanVector` instead of implementing it. Adds a `fn main` wrapper so that the example can integrate with Rust Playground.
…=GuillaumeGomez improve `BitAnd` trait documentation This pull request is based on the discussion in PR rust-lang#35927. Add a module-level note that `&&` and `||` are short-circuiting operators and not overloadable. Add a simple `Scalar` example that lifts the `&` operator to a trivial struct tuple. Make `BooleanVector` a struct tuple. Derive `PartialEq` for `BooleanVector` instead of implementing it. Adds a `fn main` wrapper so that the example can integrate with Rust Playground.
…=GuillaumeGomez improve `BitAnd` trait documentation This pull request is based on the discussion in PR rust-lang#35927. Add a module-level note that `&&` and `||` are short-circuiting operators and not overloadable. Add a simple `Scalar` example that lifts the `&` operator to a trivial struct tuple. Make `BooleanVector` a struct tuple. Derive `PartialEq` for `BooleanVector` instead of implementing it. Adds a `fn main` wrapper so that the example can integrate with Rust Playground.
These are exactly equivalent to PR rust-lang#35809, with one caveat: I do not believe there is a non-bitwise binary "xor" operator in Rust, so here it's expressed as (a || b) && !(a && b). r? @GuillaumeGomez improved documentation a la PR rust-lang#35993
This is the augmented-assignment version of PR rust-lang#35809. r? @GuillaumeGomez improved documentation a la PR rust-lang#35993
This pull request is based on the discussion in PR #35927.
Add a module-level note that
&&
and||
are short-circuiting operators and not overloadable.Add a simple
Scalar
example that lifts the&
operator to a trivial struct tuple.Make
BooleanVector
a struct tuple.Derive
PartialEq
forBooleanVector
instead of implementing it.Adds a
fn main
wrapper so that the example can integrate with Rust Playground.