Skip to content

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

@BrianMichell

Description

@BrianMichell
          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)

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions