Type Definition obj_pool::OptionObjId [−][src]
type OptionObjId = Optioned<ObjId>;
Optimization for Option<ObjId> which treats ObjId of u32::max_value() as None.
It's safe to store any ObjPool ObjId in this wrapper as long as the size of the ObjPool is
less than u32::max_value() / 2.
use obj_pool::{ObjPool, ObjId, OptionObjId}; let mut obj_pool = ObjPool::default(); let mut n: OptionObjId = obj_pool.insert(10).into(); assert!(n.is_some()); assert_eq!(10, obj_pool[n.unwrap()]); n = OptionObjId::none(); assert!(n.is_none()); assert_eq!(None, n.into_option());