Skip to content

Put the struct data into a RefCell within the ComClass #75

Description

@Rantanen

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)]

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions