Skip to content
This repository was archived by the owner on Mar 15, 2025. It is now read-only.
This repository was archived by the owner on Mar 15, 2025. It is now read-only.

Add scoped providers #32

Description

@TehPers

Add a way for providers to have a scope. For example, one way a scope might be implemented is this:

let scope = injector.scope(); // has Drop impl
let foo: Svc<Foo> = scope.get().unwrap();

Scoped providers don't guarantee the lifetime of the values that they provide. If a scope is dropped, there's no way to know if all references to the services it provided were dropped since they use reference-counted pointers or have been moved to outside of the injector (in the case of owned injection). Instead, scopes only would guarantee that scoped providers provide the same instances from the same scope, and different instances from different scopes.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions