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

Think of optimization api implementation helper #344

Open
u9g opened this issue Jul 7, 2023 · 0 comments
Open

Think of optimization api implementation helper #344

u9g opened this issue Jul 7, 2023 · 0 comments

Comments

@u9g
Copy link
Contributor

u9g commented Jul 7, 2023

Based on this pr: #339 it's super easy to implement one case of CandidateValue and forget about the rest, so a helper for implementing the Single/Multiple cases might be helpful.

An idea for api design:

make_iterator_from(
    resolve_info, // scan for CandidateValue::Single / CandidateValue::Multiple
    "name" // statically required property
    |key| Box::new(std::iter::once(Vertex::MyVertex(collection.get(key)))), // single candidate
    |keys| Box::new(keys.map(|key| Vertex::MyVertex(collection.get(key)))), // multiple candidates
    || Box::new(collection.values().map(|value| Vertex::MyVertex(value)))
)

Although maybe we can skip the ceremony and instead just have the programmer give us a way to lookup the key in the collection or transform the key into a vertex and implement the first two fn's ourselves

Once this is resolved, it can be added to stubgen.

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

1 participant