> Yes, the usual approach is to have a Ref and a RefMut type e.g. Opaque and > OpaqueMut, and the OpaqueMut type can dereference immutably as an Opaque. > > See std::cell::{Ref, RefMut} for inspiration. >
Thanks! I'll dorp Opaque directly for this case. If there're more similar cases, then we can have a OpaqueRef<>. Regards, Zhao