Skip to content

Derive Copy on fixed-size types like Hash, Uint256, AccountId #511

Description

@tomerweller

What

The code generator derives Copy on C-like #[repr(i32)] enums but never on structs, typedefs, or union enums - even when all their fields are Copy.
This means types like Hash, Uint256, PublicKey, AccountId, and MuxedAccount are Clone-only despite being small fixed-size values whose entire composition chain is [u8; 32] and other primitives.

Why

These types are frequently used in downstream code. Without Copy, every assignment, key construction, map lookup, or pattern-match extraction requires an explicit .clone(). In practice this leads to hundreds of gratuitous clone calls in any non-trivial Stellar Rust project.
Adding Copy is backward-compatible — existing .clone() calls continue to compile.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions