let c: OwningRef<Rc<Vec<u8>>, [u8]> = unsafe {a.map_owner(Rc::new)};
let d: OwningRef<Rc<Box<[u8]>>, [u8]> = unsafe {b.map_owner(Rc::new)};
- let e: OwningRef<Rc<Erased>, [u8]> = c.erase_owner();
- let f: OwningRef<Rc<Erased>, [u8]> = d.erase_owner();
+ let e: OwningRef<Rc<dyn Erased>, [u8]> = c.erase_owner();
+ let f: OwningRef<Rc<dyn Erased>, [u8]> = d.erase_owner();
let _g = e.clone();
let _h = f.clone();
let c: OwningRef<Box<Vec<u8>>, [u8]> = a.map_owner_box();
let d: OwningRef<Box<Box<[u8]>>, [u8]> = b.map_owner_box();
- let _e: OwningRef<Box<Erased>, [u8]> = c.erase_owner();
- let _f: OwningRef<Box<Erased>, [u8]> = d.erase_owner();
+ let _e: OwningRef<Box<dyn Erased>, [u8]> = c.erase_owner();
+ let _f: OwningRef<Box<dyn Erased>, [u8]> = d.erase_owner();
}
#[test]
use std::any::Any;
let x = Box::new(123_i32);
- let y: Box<Any> = x;
+ let y: Box<dyn Any> = x;
OwningRef::new(y).try_map(|x| x.downcast_ref::<i32>().ok_or(())).is_ok();
}
use std::any::Any;
let x = Box::new(123_i32);
- let y: Box<Any> = x;
+ let y: Box<dyn Any> = x;
OwningRef::new(y).try_map(|x| x.downcast_ref::<i32>().ok_or(())).is_err();
}
let c: OwningRefMut<Box<Vec<u8>>, [u8]> = unsafe {a.map_owner(Box::new)};
let d: OwningRefMut<Box<Box<[u8]>>, [u8]> = unsafe {b.map_owner(Box::new)};
- let _e: OwningRefMut<Box<Erased>, [u8]> = c.erase_owner();
- let _f: OwningRefMut<Box<Erased>, [u8]> = d.erase_owner();
+ let _e: OwningRefMut<Box<dyn Erased>, [u8]> = c.erase_owner();
+ let _f: OwningRefMut<Box<dyn Erased>, [u8]> = d.erase_owner();
}
#[test]
let c: OwningRefMut<Box<Vec<u8>>, [u8]> = a.map_owner_box();
let d: OwningRefMut<Box<Box<[u8]>>, [u8]> = b.map_owner_box();
- let _e: OwningRefMut<Box<Erased>, [u8]> = c.erase_owner();
- let _f: OwningRefMut<Box<Erased>, [u8]> = d.erase_owner();
+ let _e: OwningRefMut<Box<dyn Erased>, [u8]> = c.erase_owner();
+ let _f: OwningRefMut<Box<dyn Erased>, [u8]> = d.erase_owner();
}
#[test]
use std::any::Any;
let x = Box::new(123_i32);
- let y: Box<Any> = x;
+ let y: Box<dyn Any> = x;
OwningRefMut::new(y).try_map_mut(|x| x.downcast_mut::<i32>().ok_or(())).is_ok();
}
use std::any::Any;
let x = Box::new(123_i32);
- let y: Box<Any> = x;
+ let y: Box<dyn Any> = x;
OwningRefMut::new(y).try_map_mut(|x| x.downcast_mut::<i32>().ok_or(())).is_err();
}
use std::any::Any;
let x = Box::new(123_i32);
- let y: Box<Any> = x;
+ let y: Box<dyn Any> = x;
OwningRefMut::new(y).try_map(|x| x.downcast_ref::<i32>().ok_or(())).is_ok();
}
use std::any::Any;
let x = Box::new(123_i32);
- let y: Box<Any> = x;
+ let y: Box<dyn Any> = x;
OwningRefMut::new(y).try_map(|x| x.downcast_ref::<i32>().ok_or(())).is_err();
}