#unsafe #pointers #access

unsafe-ref

Allow raw pointer access without those pesky unsafe blocks everywhere!

1 stable release

1.0.0 Jan 23, 2022

#110 in #unsafe

MIT license

4KB
69 lines

unsafe-ref-rust

Allow raw pointer access without those pesky unsafe blocks everywhere!

let mut a = A(0);
let mut x: UnsafeMutRef<dyn Foo> = UnsafeMutRef::new(&mut a);
let mut y: UnsafeMutRef<dyn Foo> = UnsafeMutRef::new(&mut a);
let z: UnsafeRef<dyn Foo> = UnsafeRef::new(&a);
x.set(42);
y.set(z.get() + 10);

No runtime deps