``` suspend fun read(min: Int = 1, consumer: (Byte...
# ktor
Copy code
suspend fun read(min: Int = 1, consumer: (ByteBuffer) -> Unit)
I'm trying to implement a usage of this function but I'm getting type mismatch error Required: (ByteBuffer) -> Unit Found: ByteBuffer! Can someone give me an example or link to a code that uses (Int/String/Any) -> Unit ?
I'm ashamed to ask for this but my lambda experience is bad
You’re passing a ByteBuffer to the function when you should be passing a function that consumes a ByteBuffer, like so:
Copy code
read { buffer: ByteBuffer ->
I doubt that’ll compile, but it’s the correct syntax.