Currently the COM calls are skipping borrow checkers and there are no real safeties against calling multiple &mut self methods in parallel.
We should try to achieve the following:
- If all of the implemented interfaces/etc. are defined as
&self methods, the underlying type will be ImmutableComClass which has the type without a RefCell. This allows more performant calls (no borrow checking). The user can use such types for immutable data or for performance critical mutable data at which point they are responsible for handling the mutable data with their own RefCells.
- If any of the implemented interfaces/etc. use
&mut self, the underlying type will be MutableComClass which has the type within a RefCell. This enables runtime borrow checking.
This might need us to expand the #[com_class] attribute with something like #[com_class_mut] or #[com_class(IReadOnlyInterface, mut IWriteInterface)]
Currently the COM calls are skipping borrow checkers and there are no real safeties against calling multiple &mut self methods in parallel.
We should try to achieve the following:
&selfmethods, the underlying type will beImmutableComClasswhich has the type without aRefCell. This allows more performant calls (no borrow checking). The user can use such types for immutable data or for performance critical mutable data at which point they are responsible for handling the mutable data with their own RefCells.&mut self, the underlying type will beMutableComClasswhich has the type within aRefCell. This enables runtime borrow checking.This might need us to expand the
#[com_class]attribute with something like#[com_class_mut]or#[com_class(IReadOnlyInterface, mut IWriteInterface)]