Skip to content

Conversation

@cecton
Copy link
Contributor

@cecton cecton commented Mar 3, 2025

Closes #17
Closes #34

@cecton cecton requested a review from kirillsemyonkin March 3, 2025 16:30
@kirillsemyonkin
Copy link
Collaborator

kirillsemyonkin commented Mar 3, 2025

Actually now that I think about it, it should be the only proper way. The Vec is just that optimal for making size-changing mutations (automatic reallocations and whatnot), it does not make sense to try to introduce some custom workaround that is definitely worse. For non-size-changing operations, make_mut already exists.

I got reminded that the Single variant prevents recursive structures:

#[derive(Clone)]
struct Node {
    children: IArray<Node>, // error: infinite size, because of the [Node; 1] variant
    // use `children: Rc<IArray<Node>>,` instead
}

impl ImplicitClone for Node {}

There probably should be an issue.

@cecton cecton merged commit 3dd57d7 into yewstack:main Mar 3, 2025
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Immutable collection operations

2 participants