Enum with contents

val user: LiveData<Result> = liveData {
    try {
    } catch(ioException: Exception) {

The class Result looks similar to a struct enum in Rust where the success variant can carry a User while the loading variant does not.

I’m fairly new to Kotlin and I wonder how that class would be defined.

The code is from here but that page is not about the Result class.

See documentation about sealed classes.