use rt_vec::RtVec;
struct A(u32);
fn main() {
let mut rt_vec = RtVec::new();
rt_vec.push(A(1));
rt_vec.push(A(2));
let mut a = rt_vec.borrow_mut(0);
let mut b = rt_vec.borrow_mut(1);
a.0 = 2;
b.0 = 3;
drop(a);
drop(b);
let a_0 = rt_vec.borrow(0);
let _a_1 = rt_vec.borrow(0);
let b = rt_vec.borrow(1);
println!("A: {}", a_0.0);
println!("B: {}", b.0);
let a_try_borrow_mut = rt_vec.try_borrow_mut(0);
let exists = if a_try_borrow_mut.is_ok() {
"Ok(..)"
} else {
"Err"
};
println!("a_try_borrow_mut: {}", exists); }