Default

class Default<T>(t: T) : SafeWrapper<T> (source)

Default implementation of SafeWrapper that wraps a provided target.

Type Parameters

T

The type of the wrapped target

Constructors

Link copied to clipboard
constructor(t: T)

Functions

Link copied to clipboard
open fun <R> safe(block: T.() -> R): Result<R>

Executes a synchronous block on the target, catching any exceptions and returning a Result.

Link copied to clipboard
open suspend fun <R> safeS(block: suspend T.() -> R): Result<R>

Executes a suspending block on the target, catching any exceptions (except kotlinx.coroutines.CancellationException) and returning a Result.

Link copied to clipboard
open fun <R> unsafe(block: T.() -> R): R

Executes a synchronous block on the target without exception handling.

Link copied to clipboard
open suspend fun <R> unsafeS(block: suspend T.() -> R): R

Executes a suspending block on the target without exception handling.

Link copied to clipboard
open override fun unsafeTarget(): T

Provides access to the underlying wrapped target object.