Function ::std::is_writable

fn is_writable(value) -> bool

Test if the given value is writable.

A value is writable if can be acquired for exclusive access, such as producing a mutable reference or taking ownership.

Examples

let value = Some(42);
assert!(is_writable(value));
let value2 = value.map(|v| v + 1);
assert!(!is_writable(value));
assert_eq!(value2, Some(43));