Skip to content

Come up with an idea for generic mutable references #1

@Robbepop

Description

@Robbepop

Generic Mutable References

Problem

Currently wrappers around objects stored on the contract storage do not provide a way to receive mutable references (&mut T) to those objects.

Rational

The reason for this is that users could do arbitrary changes to the objects without having an automated way to synchronize the storage.

Example

Storage wrappers like storage::Vec and storage::HashMap provide APIs like mutate_with with which it is possible for users to do an efficient in-place mutation of an object owned by the collection.

Goal

This is the tracking issue to come up with a user friendly, efficient and possibly general way to allow for mutable references that keep their referenced objects in sync between memory and storage.

Solutions

Solution 1: Do not provide mutable reference wrappers

This is the naive approach that we currently use.
However, it has the downside that it simply doesn't support what some users would like to have.

Solution 2: ?

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-ink_storage[ink_storage] Work ItemB-designDesigning a new component, interface or functionality.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions