#mut #change #memory #immutability #variables #value

yanked mut_immut

Change value of an immutable variable

0.2.1 May 30, 2022
0.2.0 May 30, 2022
0.1.0 May 30, 2022

#48 in #mut

MPL-2.0 license

3KB

crates.io License Documentation

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.

No runtime deps