com.github.rssh.appcontext

Members list

Type members

Classlikes

object AppContext

Application context is a way, to resolve components dependencies. Each component should provide an AppContextProvider, and AppContext[Component] will instantiate this components with dependencies.

Application context is a way, to resolve components dependencies. Each component should provide an AppContextProvider, and AppContext[Component] will instantiate this components with dependencies.

Attributes

Supertypes
class Object
trait Matchable
class Any
Self type
AppContext.type
trait AppContextAsyncProvider[F[_], T]

Attributes

Companion
object
Supertypes
class Object
trait Matchable
class Any

Attributes

Companion
trait
Supertypes
class Object
trait Matchable
class Any
Self type

AppContextAsyncProviderLookup is a helper trait used by InAppContext to search for async providers with correct priority:

AppContextAsyncProviderLookup is a helper trait used by InAppContext to search for async providers with correct priority:

  1. AppContextAsyncProviders in enclosing scope (highest)
  2. Local AppContextProvider (sync) converted via fromSyncProvider
  3. AppContextAsyncProvider[F, T] defined in T's companion object (lowest)

This works because implicit search looks in the companion of the result type (T), but AppContextAsyncProviderLookup[F, T]'s companion is AppContextAsyncProviderLookup, not T. So givens defined here have priority over T's companion.

Attributes

Companion
object
Supertypes
class Object
trait Matchable
class Any

Attributes

Supertypes
class Object
trait Matchable
class Any
Known subtypes

Attributes

Supertypes
class Object
trait Matchable
class Any
Known subtypes

Attributes

Supertypes
class Object
trait Matchable
class Any
Known subtypes
trait AppContextAsyncProviders[F[_], Xs <: NonEmptyTuple] extends AppContextAsyncProvidersSearch[F, Xs]

Attributes

Companion
object
Supertypes
class Object
trait Matchable
class Any

Attributes

Companion
trait
Supertypes
class Object
trait Matchable
class Any
Self type
trait AppContextAsyncProvidersSearch[F[_], Dependencies <: NonEmptyTuple]

Attributes

Supertypes
class Object
trait Matchable
class Any
Known subtypes

Attributes

Supertypes
class Object
trait Matchable
class Any
Self type

AppContextProvider is a type class that provides a value of type T

AppContextProvider is a type class that provides a value of type T

When we have AppContextProvider for a type T, then we can resolve T for dependency injection, using AppContext[T] syntax. AppContext[T]

Attributes

Companion
object
Supertypes
class Object
trait Matchable
class Any

Attributes

Companion
trait
Supertypes
class Object
trait Matchable
class Any
Self type

AppContextProviderLookup is a helper trait used by AppContext[T] to search for providers with correct priority: AppContextProviders in enclosing scope takes precedence over AppContextProvider[T] defined in T's companion object.

AppContextProviderLookup is a helper trait used by AppContext[T] to search for providers with correct priority: AppContextProviders in enclosing scope takes precedence over AppContextProvider[T] defined in T's companion object.

This works because implicit search looks in the companion of the result type (T), but AppContextProviderLookup[T]'s companion is AppContextProviderLookup, not T. So givens defined here (fromProviders) have priority over T's companion.

Attributes

Companion
object
Supertypes
class Object
trait Matchable
class Any

Attributes

Companion
trait
Supertypes
class Object
trait Matchable
class Any
Self type

Attributes

Supertypes
class Object
trait Matchable
class Any
Known subtypes

Attributes

Companion
object
Supertypes
class Object
trait Matchable
class Any

Attributes

Companion
trait
Supertypes
class Object
trait Matchable
class Any
Self type
trait AppContextProviders[Xs <: NonEmptyTuple] extends AppContextProvidersSearch[Xs]

Attributes

Companion
object
Supertypes
class Object
trait Matchable
class Any

Attributes

Companion
trait
Supertypes
class Object
trait Matchable
class Any
Self type
trait AppContextProvidersSearch[Xs <: NonEmptyTuple]

Attributes

Supertypes
class Object
trait Matchable
class Any
Known subtypes
object InAppContext

Attributes

Supertypes
class Object
trait Matchable
class Any
Self type
object TupleIndex

Attributes

Supertypes
class Object
trait Matchable
class Any
Self type
TupleIndex.type
object TupleMacroses

Attributes

Supertypes
class Object
trait Matchable
class Any
Self type
class appContextCacheClass[T] extends StaticAnnotation

Annotation to mark class as a key for component cache. Useful for cases when we have multiple implementation of some generic component. i.e.

Annotation to mark class as a key for component cache. Useful for cases when we have multiple implementation of some generic component. i.e.

Attributes

Supertypes
trait StaticAnnotation
class Annotation
class Object
trait Matchable
class Any

Types

type AppContextCacheMap[K, V] = TrieMap[K, V]
type InAppContext[Dependencies <: NonEmptyTuple] = [F[_]] =>> AppContextAsyncProviders[F, Dependencies]

Extensions

Extensions

extension (ac: AppContext.type)
def asyncGet[F[_], T](using p: AppContextAsyncProviderLookup[F, T]): F[T]