Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improving near-sandbox-util API #76

Open
ghost opened this issue Nov 6, 2023 · 0 comments
Open

Improving near-sandbox-util API #76

ghost opened this issue Nov 6, 2023 · 0 comments

Comments

@ghost
Copy link

ghost commented Nov 6, 2023

Issue

In the README there's documentation to be added for the Rust section: https://github.com/near/sandbox/blob/50d8df010b8b436bc71ec1fbf9ed2841e5b131a1/README.md?plain=1#L31

Possible Solution

I jumped the gun and started on an implementation but it's better discussed.

We can add this missing documentation and also provide better UX for developers who will/might use the sandbox standalone. Using an api like proposed, near/near-workspaces-rs#88 (comment), will be an improvement over calling individual functions.
Below is my (rough) api proposal.

#[must_use = "init() must be called before running the sandbox"]
pub struct SandboxHandle {
    bin_path: PathBuf,
    home_dir: PathBuf,
    proc: Option<tokio::process::Child>,
}

impl SandboxHandle {
    fn new(version: &str, home_dir: &str) -> Result<()> { todo!() }

    fn init(&self) -> Result<()> { todo!() }

    fn run(&self) -> Result<()> { todo!() }

    fn run_with_args(&self, args: &[&str]) -> Result<()> { todo!() }
}

impl Default for SandboxHandle { ... }
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

No branches or pull requests

0 participants