# num_traits::ops::wrapping::WrappingShr - Rust
API documentation for the Rust `WrappingShr` trait in crate `num_traits`.
Keywords: rust, rustlang, rust-lang, WrappingShr

# [−] [src] Trait num_traits::ops::wrapping::WrappingShr

    pub trait WrappingShr: Sized + Shr<usize, Output = Self> {
        fn wrapping_shr(&self, rhs: u32) -> Self;
    }

Performs a right shift that does not panic.

## Required methods

### `fn wrapping_shr(&self, rhs: u32) -> Self`

Panic-free bitwise shift-right; yields `self >> mask(rhs)`, where `mask` removes any high order bits of `rhs` that would cause the shift to exceed the bitwidth of the type.

    use num_traits::WrappingShr;

    let x: u16 = 0x8000;

    assert_eq!(WrappingShr::wrapping_shr(&x, 0),  0x8000);
    assert_eq!(WrappingShr::wrapping_shr(&x, 1),  0x4000);
    assert_eq!(WrappingShr::wrapping_shr(&x, 15), 0x0001);
    assert_eq!(WrappingShr::wrapping_shr(&x, 16), 0x8000);

Loading content...

## Implementations on Foreign Types

### `impl WrappingShr for u8` [src]

#### `fn wrapping_shr(&self, rhs: u32) -> u8` [src]

### `impl WrappingShr for u16` [src]

#### `fn wrapping_shr(&self, rhs: u32) -> u16` [src]

### `impl WrappingShr for u32` [src]

#### `fn wrapping_shr(&self, rhs: u32) -> u32` [src]

### `impl WrappingShr for u64` [src]

#### `fn wrapping_shr(&self, rhs: u32) -> u64` [src]

### `impl WrappingShr for usize` [src]

#### `fn wrapping_shr(&self, rhs: u32) -> usize` [src]

### `impl WrappingShr for u128` [src]

#### `fn wrapping_shr(&self, rhs: u32) -> u128` [src]

### `impl WrappingShr for i8` [src]

#### `fn wrapping_shr(&self, rhs: u32) -> i8` [src]

### `impl WrappingShr for i16` [src]

#### `fn wrapping_shr(&self, rhs: u32) -> i16` [src]

### `impl WrappingShr for i32` [src]

#### `fn wrapping_shr(&self, rhs: u32) -> i32` [src]

### `impl WrappingShr for i64` [src]

#### `fn wrapping_shr(&self, rhs: u32) -> i64` [src]

### `impl WrappingShr for isize` [src]

#### `fn wrapping_shr(&self, rhs: u32) -> isize` [src]

### `impl WrappingShr for i128` [src]

#### `fn wrapping_shr(&self, rhs: u32) -> i128` [src]

### `impl<T: WrappingShr> WrappingShr for Wrapping<T> where
Wrapping<T>: Shr<usize, Output = Wrapping<T>>,` [src]

#### `fn wrapping_shr(&self, rhs: u32) -> Self` [src]

Loading content...

## Implementors

Loading content...

# Help

## Keyboard Shortcuts

`?`
  Show this help dialog
`S`
  Focus the search field
`↑`
  Move up in search results
`↓`
  Move down in search results
`↹`
  Switch tab
`⏎`
  Go to active search result
`+`
  Expand all sections
`-`
  Collapse all sections

## 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`)

Search multiple things at once by splitting your query with comma (e.g., `str,u8` or `String,struct:Vec,test`)