# Trait core::ops::BitAndAssign 1.8.0 [−] [src]

    pub trait BitAndAssign<Rhs = Self> {
        fn bitand_assign(&mut self, Rhs);
    }

The `BitAndAssign` trait is used to specify the functionality of `&=`.

# Examples

A trivial implementation of `BitAndAssign`. When `Foo &= Foo` happens, it ends up calling `bitand_assign`, and therefore, `main` prints `Bitwise And-ing!`.

use std::ops::BitAndAssign; struct Foo; impl BitAndAssign for Foo { fn bitand_assign(&mut self, _rhs: Foo) { println!("Bitwise And-ing!"); } } #[allow(unused_assignments)] fn main() { let mut foo = Foo; foo &= Foo; }

    use std::ops::BitAndAssign;

    struct Foo;

    impl BitAndAssign for Foo {
        fn bitand_assign(&mut self, _rhs: Foo) {
            println!("Bitwise And-ing!");
        }
    }

    fn main() {
        let mut foo = Foo;
        foo &= Foo;
    }

## Required Methods

### `fn bitand_assign(&mut self, Rhs)`

The method for the `&` operator

## Implementors

- `impl BitAndAssign for Wrapping<usize>`
- `impl BitAndAssign for Wrapping<u8>`
- `impl BitAndAssign for Wrapping<u16>`
- `impl BitAndAssign for Wrapping<u32>`
- `impl BitAndAssign for Wrapping<u64>`
- `impl BitAndAssign for Wrapping<isize>`
- `impl BitAndAssign for Wrapping<i8>`
- `impl BitAndAssign for Wrapping<i16>`
- `impl BitAndAssign for Wrapping<i32>`
- `impl BitAndAssign for Wrapping<i64>`
- `impl BitAndAssign for bool`
- `impl BitAndAssign for usize`
- `impl BitAndAssign for u8`
- `impl BitAndAssign for u16`
- `impl BitAndAssign for u32`
- `impl BitAndAssign for u64`
- `impl BitAndAssign for isize`
- `impl BitAndAssign for i8`
- `impl BitAndAssign for i16`
- `impl BitAndAssign for i32`
- `impl BitAndAssign for i64`

# Help

## Keyboard Shortcuts

?
  Show this help dialog
S
  Focus the search field
⇤
  Move up in search results
⇥
  Move down in search results
⏎
  Go to active search result

## Search Tricks

Prefix searches with a type followed by a colon (e.g. `fn:`) to restrict the search to a given type.

Accepted types are: `fn`, `mod`, `struct`, `enum`, `trait`, `type`, `macro`, and `const`.

Search functions by type signature (e.g. `vec -> usize` or `* -> vec`)