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

[FEATURE] Return API #18

Open
mackysoft opened this issue Feb 22, 2022 · 0 comments
Open

[FEATURE] Return API #18

mackysoft opened this issue Feb 22, 2022 · 0 comments
Assignees
Labels
enhancement New feature or request

Comments

@mackysoft
Copy link
Owner

mackysoft commented Feb 22, 2022

I would like to have such an API for simpler object return to a pool.

Fluid Syntax

// When an instance is disabled, it is returned to a pool.
var instance = m_Pool.Rent()
    .ReturnOnDisable(m_Pool); // Attach OnDisableTrigger

Disposable pattern

var disposable = m_Pool.Rent(out var instance);

// Return to a pool in callbacks such as object completion.
instance.OnCompleted = () => disposable.Dispose();
@mackysoft mackysoft added the enhancement New feature or request label Feb 22, 2022
@mackysoft mackysoft self-assigned this Feb 22, 2022
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