#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

#57 in #mut

Download history 6/week @ 2024-02-23 3/week @ 2024-03-01 43/week @ 2024-03-29 9/week @ 2024-04-05

52 downloads per month

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