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

Adding support of binding as a struct but resolving as an interface #50

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

dyrkin
Copy link

@dyrkin dyrkin commented Mar 28, 2023

Hi!
First of all, thank your hard work and for this excellent container!

I've added support for instances resolving by an interface, even if they were bound as structs.
We need this as we are trying to make a library that provides different receiver functions. The library knows nothing about containers and uses locally created interfaces about whose the client application knows nothing too. But the client application creates a container with different bound objects that will be used to fill in these resolve functions from the library.
Not sure if my motivation is clear, but I hope so. I can add more details. I would very much appreciate merging this.

@Numichi
Copy link

Numichi commented Aug 16, 2023

And what is the expected operation if several structs implement the same interface? Which will first? Or find all and give a array?

@dyrkin
Copy link
Author

dyrkin commented Aug 22, 2023

The same can be done for structs. You can bind multiple. But you can name them to resolve the instance you want

@MrVermond
Copy link

Could you please extend the documentation to make clear how the change behaves?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants