i know that using RefCell
has a runtime cost, and also i’ve learn that i can avoid using it by replacing it with Cell<Option<T>>
or Cell<T>(T impl Default)
and use take
or replace
to get the instance, mutate it then put it back.
but there’s also some cost, i have to wrap T with Some
and use if let Some(t)
& .set(Some(t))
to get and put it back. i don’t know if it worth replacing RefCell with Cell<Option>