Skip to content

Don't implement Copy on certain BoxedInline structs #1532

Open
@SeaDve

Description

@SeaDve

Currently, it implements Copy, which could cause unexpected behaviors. I think it is better to just implement Clone, so the user can explicitly create a copy of the iterator.

This is also the reason why Range from std lib doesn't implement Copy, even though the underlying type implements copy.

Example:

let mut text_start = text_end;
text_start.backward_line();

Does text_end also move backward a line? (Spoiler: it does not, since it is creating a copy behind the scenes)

let mut text_start = text_end.clone();
text_start.backward_line();

Here, it is explicit that we are making a deep copy of the text_end.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions