Package-level declarations

Types

Link copied to clipboard
typealias Factory<T> = () -> T

A factory function that creates an instance of type T.

Link copied to clipboard
open class FactoryProvider<T>(factory: Factory<T>) : Provider<T>

A provider of instances of type T that are created by the given factory.

Link copied to clipboard
Link copied to clipboard
interface PortRequest

Base interface for all port requests. Implementing classes should ideally be sealed classes or sealed interfaces to represent a limited set of valid requests.

Link copied to clipboard
interface PortResponse

Base interface for all port responses. Implementing classes should ideally be sealed classes or sealed interfaces to represent a limited set of valid responses.

Link copied to clipboard
interface Provider<T>

A provider of instances of type T.

Link copied to clipboard
class ResponseReceiver<RES : PortResponse>(val response: RES)

A receiver for a PortResponse that allows for pattern matching on the response type.

Link copied to clipboard
open class SingletonProvider<T>(factory: Factory<T>) : Provider<T>

A provider of instances of type T that are created by the given Factory and cached.

Functions

Link copied to clipboard
infix fun <RES : PortResponse> RES.then(block: ResponseReceiver<RES>.() -> Unit)

Infix function to chain a response receiver to a response.

Link copied to clipboard
infix fun <REQ : PortRequest, RES : PortResponse> REQ.via(port: Port<REQ, RES>): RES

Infix function to chain a request to a port, processing it and returning a response.