0.2.1 |
|
---|---|
0.2.0 |
|
0.1.0 |
|
#48 in #mut
3KB
mut_immut
Change value of an immutable variable!!!
Examples:
extern crate mut_immut;
use mut_immut::change;
fn main() {
let a: u8 = 6;
change(&a, 255);
println!("{a}"); // >> 255
}
extern crate mut_immut;
use mut_immut::*;
fn main() {
let a: u8 = 15;
let mut mut_a = get_mut(&a);
*mut_a = 8;
println!("{a}"); // >> 8
}
lib.rs
:
mut_immut is a small crate with a function "change" which allows you to change value of a variable without mutating it.