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

Can we have a Macro to do the open and assign. #116

Open
BrianMichell opened this issue Sep 13, 2024 · 0 comments
Open

Can we have a Macro to do the open and assign. #116

BrianMichell opened this issue Sep 13, 2024 · 0 comments
Assignees
Labels
enhancement New feature or request

Comments

@BrianMichell
Copy link
Collaborator

          Can we have a Macro to do the open and assign. Also, since we return a Future, can this be async?

Somehting like ASSIGN OR RETURN

auto dsRes = mdio::Dataset::Open(dataset_path, mdio::constants::kOpen);
if (!dsRes.status().ok()) {
return dsRes.status();
}
mdio::Dataset ds = dsRes.value();

Is there a macro for this pattern, it's fine but I makes for more reading.

  if (!spec.status().ok()) {
    // Something went wrong with Tensorstore retrieving the spec
    return spec.status();
  }
  auto specJsonResult = spec.value().ToJson(IncludeDefaults{});
  if (!specJsonResult.status().ok()) {
    return specJsonResult.status();
  }

Originally posted by @blasscoc in #115 (comment)

@BrianMichell BrianMichell self-assigned this Sep 13, 2024
@BrianMichell BrianMichell added the enhancement New feature or request label Sep 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant