encapsulate

fun <O> encapsulate(value: Any, callback: <Error class: unknown class><T>.(T) -> O): O?