# Trait alloc::borrow::BorrowMut 1.0.0 [−] [src]

    pub trait BorrowMut<Borrowed>: Borrow<Borrowed> where
        Borrowed: ?Sized, {
        fn borrow_mut(&mut self) -> &mut Borrowed;
    }

A trait for mutably borrowing data.

Similar to `Borrow`, but for mutable borrows.

## Required Methods

### `fn borrow_mut(&mut self) -> &mut Borrowed`

Mutably borrows from an owned value.

# Examples

    use std::borrow::BorrowMut;

    fn check<T: BorrowMut<[i32]>>(mut v: T) {
        assert_eq!(&mut [1, 2, 3], v.borrow_mut());
    }

    let v = vec![1, 2, 3];

    check(v);

## Implementors

- `impl<T: ?Sized> BorrowMut<T> for Box<T>`
- `impl<T> BorrowMut<[T]> for [T; Const { ty: usize, val: Unevaluated(DefId { krate: CrateNum(1), node: DefIndex(1:8344) => core/5e4b76f::array[0]::{{impl}}[59]::{{initializer}}[0] }, Slice([])) }]`
- `impl<T> BorrowMut<[T]> for [T; Const { ty: usize, val: Unevaluated(DefId { krate: CrateNum(1), node: DefIndex(1:8282) => core/5e4b76f::array[0]::{{impl}}[37]::{{initializer}}[0] }, Slice([])) }]`
- `impl<T> BorrowMut<[T]> for [T; Const { ty: usize, val: Unevaluated(DefId { krate: CrateNum(1), node: DefIndex(1:8623) => core/5e4b76f::array[0]::{{impl}}[158]::{{initializer}}[0] }, Slice([])) }]`
- `impl<T> BorrowMut<[T]> for [T; Const { ty: usize, val: Unevaluated(DefId { krate: CrateNum(1), node: DefIndex(1:8902) => core/5e4b76f::array[0]::{{impl}}[257]::{{initializer}}[0] }, Slice([])) }]`
- `impl<T> BorrowMut<[T]> for [T; Const { ty: usize, val: Unevaluated(DefId { krate: CrateNum(1), node: DefIndex(1:8747) => core/5e4b76f::array[0]::{{impl}}[202]::{{initializer}}[0] }, Slice([])) }]`
- `impl<T> BorrowMut<[T]> for [T; Const { ty: usize, val: Unevaluated(DefId { krate: CrateNum(1), node: DefIndex(1:8189) => core/5e4b76f::array[0]::{{impl}}[4]::{{initializer}}[0] }, Slice([])) }]`
- `impl<T> BorrowMut<[T]> for [T; Const { ty: usize, val: Unevaluated(DefId { krate: CrateNum(1), node: DefIndex(1:8995) => core/5e4b76f::array[0]::{{impl}}[290]::{{initializer}}[0] }, Slice([])) }]`
- `impl<T> BorrowMut<[T]> for [T; Const { ty: usize, val: Unevaluated(DefId { krate: CrateNum(1), node: DefIndex(1:9119) => core/5e4b76f::array[0]::{{impl}}[334]::{{initializer}}[0] }, Slice([])) }]`
- `impl<T> BorrowMut<[T]> for [T; Const { ty: usize, val: Unevaluated(DefId { krate: CrateNum(1), node: DefIndex(1:9088) => core/5e4b76f::array[0]::{{impl}}[323]::{{initializer}}[0] }, Slice([])) }]`
- `impl<T> BorrowMut<[T]> for [T; Const { ty: usize, val: Unevaluated(DefId { krate: CrateNum(1), node: DefIndex(1:8375) => core/5e4b76f::array[0]::{{impl}}[70]::{{initializer}}[0] }, Slice([])) }]`
- `impl<T> BorrowMut<[T]> for [T; Const { ty: usize, val: Unevaluated(DefId { krate: CrateNum(1), node: DefIndex(1:8406) => core/5e4b76f::array[0]::{{impl}}[81]::{{initializer}}[0] }, Slice([])) }]`
- `impl<T> BorrowMut<[T]> for [T; Const { ty: usize, val: Unevaluated(DefId { krate: CrateNum(1), node: DefIndex(1:8592) => core/5e4b76f::array[0]::{{impl}}[147]::{{initializer}}[0] }, Slice([])) }]`
- `impl<T> BorrowMut<[T]> for [T; Const { ty: usize, val: Unevaluated(DefId { krate: CrateNum(1), node: DefIndex(1:8561) => core/5e4b76f::array[0]::{{impl}}[136]::{{initializer}}[0] }, Slice([])) }]`
- `impl<T> BorrowMut<T> for T where
  T: ?Sized,`
- `impl<T> BorrowMut<[T]> for [T; Const { ty: usize, val: Unevaluated(DefId { krate: CrateNum(1), node: DefIndex(1:8251) => core/5e4b76f::array[0]::{{impl}}[26]::{{initializer}}[0] }, Slice([])) }]`
- `impl<T> BorrowMut<[T]> for [T; Const { ty: usize, val: Unevaluated(DefId { krate: CrateNum(1), node: DefIndex(1:8964) => core/5e4b76f::array[0]::{{impl}}[279]::{{initializer}}[0] }, Slice([])) }]`
- `impl<T> BorrowMut<[T]> for [T; Const { ty: usize, val: Unevaluated(DefId { krate: CrateNum(1), node: DefIndex(1:8685) => core/5e4b76f::array[0]::{{impl}}[180]::{{initializer}}[0] }, Slice([])) }]`
- `impl<T> BorrowMut<[T]> for [T; Const { ty: usize, val: Unevaluated(DefId { krate: CrateNum(1), node: DefIndex(1:8499) => core/5e4b76f::array[0]::{{impl}}[114]::{{initializer}}[0] }, Slice([])) }]`
- `impl<T> BorrowMut<[T]> for [T; Const { ty: usize, val: Unevaluated(DefId { krate: CrateNum(1), node: DefIndex(1:8468) => core/5e4b76f::array[0]::{{impl}}[103]::{{initializer}}[0] }, Slice([])) }]`
- `impl<T> BorrowMut<[T]> for [T; Const { ty: usize, val: Unevaluated(DefId { krate: CrateNum(1), node: DefIndex(1:9150) => core/5e4b76f::array[0]::{{impl}}[345]::{{initializer}}[0] }, Slice([])) }]`
- `impl<T> BorrowMut<[T]> for [T; Const { ty: usize, val: Unevaluated(DefId { krate: CrateNum(1), node: DefIndex(1:9181) => core/5e4b76f::array[0]::{{impl}}[356]::{{initializer}}[0] }, Slice([])) }]`
- `impl<T> BorrowMut<[T]> for [T; Const { ty: usize, val: Unevaluated(DefId { krate: CrateNum(1), node: DefIndex(1:8809) => core/5e4b76f::array[0]::{{impl}}[224]::{{initializer}}[0] }, Slice([])) }]`
- `impl<T> BorrowMut<[T]> for [T; Const { ty: usize, val: Unevaluated(DefId { krate: CrateNum(1), node: DefIndex(1:8437) => core/5e4b76f::array[0]::{{impl}}[92]::{{initializer}}[0] }, Slice([])) }]`
- `impl<T> BorrowMut<[T]> for [T; Const { ty: usize, val: Unevaluated(DefId { krate: CrateNum(1), node: DefIndex(1:8716) => core/5e4b76f::array[0]::{{impl}}[191]::{{initializer}}[0] }, Slice([])) }]`
- `impl<T> BorrowMut<[T]> for [T; Const { ty: usize, val: Unevaluated(DefId { krate: CrateNum(1), node: DefIndex(1:8840) => core/5e4b76f::array[0]::{{impl}}[235]::{{initializer}}[0] }, Slice([])) }]`
- `impl<T> BorrowMut<[T]> for [T; Const { ty: usize, val: Unevaluated(DefId { krate: CrateNum(1), node: DefIndex(1:8933) => core/5e4b76f::array[0]::{{impl}}[268]::{{initializer}}[0] }, Slice([])) }]`
- `impl<T> BorrowMut<[T]> for [T; Const { ty: usize, val: Unevaluated(DefId { krate: CrateNum(1), node: DefIndex(1:8871) => core/5e4b76f::array[0]::{{impl}}[246]::{{initializer}}[0] }, Slice([])) }]`
- `impl<T> BorrowMut<[T]> for [T; Const { ty: usize, val: Unevaluated(DefId { krate: CrateNum(1), node: DefIndex(1:8530) => core/5e4b76f::array[0]::{{impl}}[125]::{{initializer}}[0] }, Slice([])) }]`
- `impl<T> BorrowMut<[T]> for [T; Const { ty: usize, val: Unevaluated(DefId { krate: CrateNum(1), node: DefIndex(1:8778) => core/5e4b76f::array[0]::{{impl}}[213]::{{initializer}}[0] }, Slice([])) }]`
- `impl<T> BorrowMut<[T]> for [T; Const { ty: usize, val: Unevaluated(DefId { krate: CrateNum(1), node: DefIndex(1:8220) => core/5e4b76f::array[0]::{{impl}}[15]::{{initializer}}[0] }, Slice([])) }]`
- `impl<T> BorrowMut<[T]> for [T; Const { ty: usize, val: Unevaluated(DefId { krate: CrateNum(1), node: DefIndex(1:9026) => core/5e4b76f::array[0]::{{impl}}[301]::{{initializer}}[0] }, Slice([])) }]`
- `impl<T> BorrowMut<[T]> for [T; Const { ty: usize, val: Unevaluated(DefId { krate: CrateNum(1), node: DefIndex(1:8654) => core/5e4b76f::array[0]::{{impl}}[169]::{{initializer}}[0] }, Slice([])) }]`
- `impl<T> BorrowMut<[T]> for [T; Const { ty: usize, val: Unevaluated(DefId { krate: CrateNum(1), node: DefIndex(1:8313) => core/5e4b76f::array[0]::{{impl}}[48]::{{initializer}}[0] }, Slice([])) }]`
- `impl<'a, T> BorrowMut<T> for &'a mut T where
  T: ?Sized,`
- `impl<T> BorrowMut<[T]> for [T; Const { ty: usize, val: Unevaluated(DefId { krate: CrateNum(1), node: DefIndex(1:9057) => core/5e4b76f::array[0]::{{impl}}[312]::{{initializer}}[0] }, Slice([])) }]`
- `impl<T> BorrowMut<[T]> for Vec<T>`

# 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
+
  Collapse/expand 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`)