pub fn last_mut(&mut self) -> Option<BitRef<Mut, T, O>> {
		match self.len() {
			0 => None,
			n => Some(unsafe { self.get_unchecked_mut(n - 1) }),
		}
	}
/// Gets a mutable reference to the last bit of the bit-slice, or `None` if
/// it is empty.
///
/// ## Original
///
/// [`slice::last_mut`](https://doc.rust-lang.org/std/primitive.slice.html#method.last_mut)
///
/// ## API Differences
///
/// `bitvec` uses a custom structure for both read-only and mutable
/// references to `bool`. This must be bound as `mut` in order to write
/// through it.
///
/// ## Examples
///
/// ```rust
/// use bitvec::prelude::*;
///
/// let bits = bits![mut 0; 3];
/// if let Some(mut last) = bits.last_mut() {
///   *last = true;
/// }
/// assert_eq!(bits, bits![0, 0, 1]);
///
/// assert!(bits![mut].last_mut().is_none());
/// ```
Gets a mutable reference to the last bit of the bit-slice, or `None` if
it is empty.
Gets a mutable reference to the last bit of the bit - slice or ` None ` if it is empty .
pub fn last_mut(&mut self) -> Option<BitRef<Mut, T, O>> {
		match self.len() {
			0 => None,
			n => Some(unsafe { self.get_unchecked_mut(n - 1) }),
		}
	}
pub fn last_mut ( & mut self ) -> Option < BitRef < Mut , T , O > > { match self . len ( ) { 0 => None , n => Some ( unsafe { self . get_unchecked_mut ( n - 1 ) } ) , } }
Gets a mutable reference to the last bit of the bit-slice, or `None` if
it is empty.
Gets a mutable reference to the last bit of the bit - slice or ` None ` if it is empty .
&mut self
&mut self
original
None
api differences
`bitvec` uses a custom structure for both read-only and mutable
references to `bool`. This must be bound as `mut` in order to write
through it.
` bitvec ` uses a custom structure for both read - only and mutable references to ` bool ` . This must be bound as ` mut ` in order to write through it .
examples
```rust
use bitvec::prelude::*.

let bits = bits![mut 0; 3];
if let Some(mut last) = bits.last_mut() {
last = true;
}
assert_eq!(bits, bits![0, 0, 1]).


` ` ` rust use bitvec :: prelude :: * . let bits = bits! [ mut 0 ; 3 ] ; if let Some ( mut last ) = bits . last_mut () { last = true ; } assert_eq! ( bits bits! [ 0 0 1 ] ) .