Skip to content

feat: provide a Cage constructor instead of hand-written full-field struct literals #1359

Description

@Yaxuan-w

Before submitting

  • I searched existing issues and discussions for similar proposals.

Problem or use case

Cage has 18 fields and no constructor. Every site that needs one writes out the full literal by hand. There are three today, and #1338 adds a fourth:

Today's design will cause adding a field to Cage breaks unrelated crates' tests. With #1338 merged, a new field in src/cage/src/cage.rs fails to compile typemap's test suite.

Proposed solution

Add a constructor to the cage crate. For example:

impl Cage {
    /// Creates a cage with the given identity and cwd; every other field
    /// starts empty/zeroed.
    pub fn new(cageid: u64, parent: u64, cwd: PathBuf) -> Self { ... }
}

Alternatives considered

No response

Additional context

No response

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

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions