W3cubDocs

/Rust

Trait std::borrow::BorrowMut

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

A trait for mutably borrowing data.

As a companion to Borrow<T> this trait allows a type to borrow as an underlying type by providing a mutable reference. See Borrow<T> for more information on borrowing as another type.

Required Methods

ⓘImportant traits for &'a mut I
impl<'a, I> Iterator for &'a mut I where
    I: Iterator + ?Sized, 
    type Item = <I as Iterator>::Item;
impl<'a, R: Read + ?Sized> Read for &'a mut R
impl<'a, W: Write + ?Sized> Write for &'a mut W

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<'a, T> BorrowMut<T> for &'a mut T where
    T: ?Sized
[src]

ⓘImportant traits for &'a mut I
impl<'a, I> Iterator for &'a mut I where
    I: Iterator + ?Sized, 
    type Item = <I as Iterator>::Item;
impl<'a, R: Read + ?Sized> Read for &'a mut R
impl<'a, W: Write + ?Sized> Write for &'a mut W

impl<T> BorrowMut<[T]> for [T; 0] [src]

ⓘImportant traits for &'a [u8]
impl<'a> Read for &'a [u8]
impl<'a> Write for &'a mut [u8]

impl<T> BorrowMut<[T]> for [T; 1] [src]

ⓘImportant traits for &'a [u8]
impl<'a> Read for &'a [u8]
impl<'a> Write for &'a mut [u8]

impl<T> BorrowMut<[T]> for [T; 2] [src]

ⓘImportant traits for &'a [u8]
impl<'a> Read for &'a [u8]
impl<'a> Write for &'a mut [u8]

impl<T> BorrowMut<[T]> for [T; 3] [src]

ⓘImportant traits for &'a [u8]
impl<'a> Read for &'a [u8]
impl<'a> Write for &'a mut [u8]

impl<T> BorrowMut<[T]> for [T; 4] [src]

ⓘImportant traits for &'a [u8]
impl<'a> Read for &'a [u8]
impl<'a> Write for &'a mut [u8]

impl<T> BorrowMut<[T]> for [T; 5] [src]

ⓘImportant traits for &'a [u8]
impl<'a> Read for &'a [u8]
impl<'a> Write for &'a mut [u8]

impl<T> BorrowMut<[T]> for [T; 6] [src]

ⓘImportant traits for &'a [u8]
impl<'a> Read for &'a [u8]
impl<'a> Write for &'a mut [u8]

impl<T> BorrowMut<[T]> for [T; 7] [src]

ⓘImportant traits for &'a [u8]
impl<'a> Read for &'a [u8]
impl<'a> Write for &'a mut [u8]

impl<T> BorrowMut<[T]> for [T; 8] [src]

ⓘImportant traits for &'a [u8]
impl<'a> Read for &'a [u8]
impl<'a> Write for &'a mut [u8]

impl<T> BorrowMut<[T]> for [T; 9] [src]

ⓘImportant traits for &'a [u8]
impl<'a> Read for &'a [u8]
impl<'a> Write for &'a mut [u8]

impl<T> BorrowMut<[T]> for [T; 10] [src]

ⓘImportant traits for &'a [u8]
impl<'a> Read for &'a [u8]
impl<'a> Write for &'a mut [u8]

impl<T> BorrowMut<[T]> for [T; 11] [src]

ⓘImportant traits for &'a [u8]
impl<'a> Read for &'a [u8]
impl<'a> Write for &'a mut [u8]

impl<T> BorrowMut<[T]> for [T; 12] [src]

ⓘImportant traits for &'a [u8]
impl<'a> Read for &'a [u8]
impl<'a> Write for &'a mut [u8]

impl<T> BorrowMut<[T]> for [T; 13] [src]

ⓘImportant traits for &'a [u8]
impl<'a> Read for &'a [u8]
impl<'a> Write for &'a mut [u8]

impl<T> BorrowMut<[T]> for [T; 14] [src]

ⓘImportant traits for &'a [u8]
impl<'a> Read for &'a [u8]
impl<'a> Write for &'a mut [u8]

impl<T> BorrowMut<[T]> for [T; 15] [src]

ⓘImportant traits for &'a [u8]
impl<'a> Read for &'a [u8]
impl<'a> Write for &'a mut [u8]

impl<T> BorrowMut<[T]> for [T; 16] [src]

ⓘImportant traits for &'a [u8]
impl<'a> Read for &'a [u8]
impl<'a> Write for &'a mut [u8]

impl<T> BorrowMut<[T]> for [T; 17] [src]

ⓘImportant traits for &'a [u8]
impl<'a> Read for &'a [u8]
impl<'a> Write for &'a mut [u8]

impl<T> BorrowMut<[T]> for [T; 18] [src]

ⓘImportant traits for &'a [u8]
impl<'a> Read for &'a [u8]
impl<'a> Write for &'a mut [u8]

impl<T> BorrowMut<[T]> for [T; 19] [src]

ⓘImportant traits for &'a [u8]
impl<'a> Read for &'a [u8]
impl<'a> Write for &'a mut [u8]

impl<T> BorrowMut<[T]> for [T; 20] [src]

ⓘImportant traits for &'a [u8]
impl<'a> Read for &'a [u8]
impl<'a> Write for &'a mut [u8]

impl<T> BorrowMut<[T]> for [T; 21] [src]

ⓘImportant traits for &'a [u8]
impl<'a> Read for &'a [u8]
impl<'a> Write for &'a mut [u8]

impl<T> BorrowMut<[T]> for [T; 22] [src]

ⓘImportant traits for &'a [u8]
impl<'a> Read for &'a [u8]
impl<'a> Write for &'a mut [u8]

impl<T> BorrowMut<[T]> for [T; 23] [src]

ⓘImportant traits for &'a [u8]
impl<'a> Read for &'a [u8]
impl<'a> Write for &'a mut [u8]

impl<T> BorrowMut<[T]> for [T; 24] [src]

ⓘImportant traits for &'a [u8]
impl<'a> Read for &'a [u8]
impl<'a> Write for &'a mut [u8]

impl<T> BorrowMut<[T]> for [T; 25] [src]

ⓘImportant traits for &'a [u8]
impl<'a> Read for &'a [u8]
impl<'a> Write for &'a mut [u8]

impl<T> BorrowMut<[T]> for [T; 26] [src]

ⓘImportant traits for &'a [u8]
impl<'a> Read for &'a [u8]
impl<'a> Write for &'a mut [u8]

impl<T> BorrowMut<[T]> for [T; 27] [src]

ⓘImportant traits for &'a [u8]
impl<'a> Read for &'a [u8]
impl<'a> Write for &'a mut [u8]

impl<T> BorrowMut<[T]> for [T; 28] [src]

ⓘImportant traits for &'a [u8]
impl<'a> Read for &'a [u8]
impl<'a> Write for &'a mut [u8]

impl<T> BorrowMut<[T]> for [T; 29] [src]

ⓘImportant traits for &'a [u8]
impl<'a> Read for &'a [u8]
impl<'a> Write for &'a mut [u8]

impl<T> BorrowMut<[T]> for [T; 30] [src]

ⓘImportant traits for &'a [u8]
impl<'a> Read for &'a [u8]
impl<'a> Write for &'a mut [u8]

impl<T> BorrowMut<[T]> for [T; 31] [src]

ⓘImportant traits for &'a [u8]
impl<'a> Read for &'a [u8]
impl<'a> Write for &'a mut [u8]

impl<T> BorrowMut<[T]> for [T; 32] [src]

ⓘImportant traits for &'a [u8]
impl<'a> Read for &'a [u8]
impl<'a> Write for &'a mut [u8]

impl<T> BorrowMut<[T]> for Vec<T> [src]

ⓘImportant traits for &'a [u8]
impl<'a> Read for &'a [u8]
impl<'a> Write for &'a mut [u8]

impl<T> BorrowMut<T> for Box<T> where
    T: ?Sized
[src]

ⓘImportant traits for &'a mut I
impl<'a, I> Iterator for &'a mut I where
    I: Iterator + ?Sized, 
    type Item = <I as Iterator>::Item;
impl<'a, R: Read + ?Sized> Read for &'a mut R
impl<'a, W: Write + ?Sized> Write for &'a mut W

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

ⓘImportant traits for &'a mut I
impl<'a, I> Iterator for &'a mut I where
    I: Iterator + ?Sized, 
    type Item = <I as Iterator>::Item;
impl<'a, R: Read + ?Sized> Read for &'a mut R
impl<'a, W: Write + ?Sized> Write for &'a mut W

© 2010 The Rust Project Developers
Licensed under the Apache License, Version 2.0 or the MIT license, at your option.
https://doc.rust-lang.org/std/borrow/trait.BorrowMut.html