Using crossinline


#1

Hi! I have read about that I should use inline in my high-order functions. My code:
in activity:
presenter.start { isUserExist ->
if (isUserExist) {
presenter.loadSettings()
} else {
startActivityWithFinish()
}
}

in presenter:
inline fun start(crossinline login: (Boolean) -> Unit) {
Repository.AuthRepo.login(deviceId).enqueue(object : Callback {
override fun onResponse(call: Call?, response: Response?) = when (response?.code()) {
HTTP_SUCCESS -> login(true)
HTTP_NO_USER -> login(false)
else -> report(R.string.all_some_error)
}

        override fun onFailure(call: Call<BaseResponse>?, t: Throwable?) {
            "LOGIN".log("onFailure: ${t?.message}")
            report(R.string.all_some_error)
        }
    })
}

Compiler recommends me to use crossinline and I understand why. But I want to understand. Will I get all benefits from inlining the high-order function when I will be using crossinline