Packages

p

izumi.distage

planning

package planning

Ordering
  1. Alphabetic
Visibility
  1. Public
  2. Protected

Package Members

  1. package extensions
  2. package gc

Type Members

  1. class AutoSetHook[INSTANCE, BINDING] extends PlanningHook

    A hook that will collect all implementations with types that are

    A hook that will collect all implementations with types that are

    _ <: T

    into a Set[T] set binding available for summoning

    Usage:

    val collectCloseables = new AutoSetHook[AutoCloseable, AutoCloseable](identity)
    
    val injector = Injector(new BootstrapModuleDef {
      many[PlanningHook]
        .add(collectCloseables)
    })

    Then, in any class created from injector:

    class App(allCloseables: Set[AutoCloseable]) {
      ...
    }

    These Auto-Sets can be used to implement custom lifetimes:

    val locator = injector.produce(modules)
    
    val closeables = locator.get[Set[AutoCloseable]]
    try { locator.get[App].runMain() } finally {
      // reverse closeables list, Auto-Sets preserve order, in the order of *initialization*
      // Therefore resources should closed in the *opposite order*
      // e.g. if C depends on B depends on A, create: A -> B -> C, close: C -> B -> A
      closeables.reverse.foreach(_.close())
    }

    Auto-Sets are NOT subject to Garbage Collection, they are assembled *after* garbage collection is done, as such they can't contain garbage by construction and they cannot be designated as GC root keys.

    _ <: T }}} available for summoning

    Usage:

    val collectCloseables = new AutoSetHook[AutoCloseable, AutoCloseable](identity)
    
    val injector = Injector(new BootstrapModuleDef {
      many[PlanningHook]
        .add(collectCloseables)
    })

    Then, in any class created from injector:

    class App(allCloseables: Set[AutoCloseable]) {
      ...
    }

    These Auto-Sets can be used to implement custom lifetimes:

    val locator = injector.produce(modules)
    
    val closeables = locator.get[Set[AutoCloseable]]
    try { locator.get[App].runMain() } finally {
      // reverse closeables list, Auto-Sets preserve order, in the order of *initialization*
      // Therefore resources should closed in the *opposite order*
      // e.g. if C depends on B depends on A, create: A -> B -> C, close: C -> B -> A
      closeables.reverse.foreach(_.close())
    }

    Auto-Sets are NOT subject to Garbage Collection, they are assembled *after* garbage collection is done, as such they can't contain garbage by construction and they cannot be designated as GC root keys.

  2. abstract class AutoSetModule extends BootstrapModuleDef

    Auto-Sets collect all bindings with static types of _implementations_ that are _ <: T into a summonable Set[T]

    Auto-Sets collect all bindings with static types of _implementations_ that are _ <: T into a summonable Set[T]

    See also

    AutoSetHook

    same concept in MacWire: https://github.com/softwaremill/macwire#multi-wiring-wireset

  3. trait BindingTranslator extends AnyRef
  4. class ForwardingRefResolverDefaultImpl extends ForwardingRefResolver
  5. class PlanAnalyzerDefaultImpl extends PlanAnalyzer
    Annotations
    @nowarn()
  6. final class PlannerDefaultImpl extends Planner
  7. final class PlanningHookAggregate extends PlanningHook
  8. final class PlanningObserverAggregate extends PlanningObserver
  9. class PruningPlanMergingPolicyDefaultImpl extends PlanMergingPolicyDefaultImpl
  10. class SanityCheckerDefaultImpl extends SanityChecker

Ungrouped