Skip to content

readFromHead/writeToTail should propagate the Int returned from the lambda #360

Closed
@JakeWharton

Description

@JakeWharton

I'm trying to implement RawSource.readAtMostTo using UnsafeBufferOperations.writeToTail.

I want to do

	override fun readAtMostTo(sink: Buffer, byteCount: Long): Long {
		return UnsafeBufferOperations.writeToTail(sink, 1) { bytes, startIndexInclusive, endIndexExclusive ->
			val read: Int = TODO()
			read
		}.toLong()
	}

but writeToTail doesn't give me the Int which I return from the lambda at the callsite in order to do this.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions