OpenAssetIO / OpenAssetIO-TraitGen

A code generation tool that produces OpenAssetIO Traits and Specifications from a simple YAML description.
Apache License 2.0
6 stars 5 forks source link

Add trait view `makeIfImbued` factory function #18

Closed feltech closed 9 months ago

feltech commented 1 year ago

What

Migrated from https://github.com/OpenAssetIO/OpenAssetIO/issues/816 since we're planning to get rid of TraitBase

myTrait = MyTrait::ifImbued(traitsData), allowing for a workflow of if myTrait := MyTrait.makeIfImbued(traitsData): ... (Python) / if (myTrait = MyTrait::makeIfImbued(traitsData)) { ... (C++). This works since shared_ptr with a nullptr is falsey in C++ and None in Python.

elliotcmorris commented 9 months ago

Closing due to low priority/not sure it's the right pattern