-
Notifications
You must be signed in to change notification settings - Fork 60
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Publish Segment.size and Segment.remainingCapacity #409
Conversation
* | ||
* @sample kotlinx.io.samples.unsafe.UnsafeBufferOperationsSamples.readUleb128 | ||
*/ | ||
public val size: Int |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Perhaps, it should be Long
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
But then both pos
and limit
have to be updated too.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The main issue here that these properties already leaked into users' projects, like Ktor.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
And the reason why we might need Long
properties here is supporting MemorySegmented backed segments on JVM (and that's nowhere near).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
MemorySegment
s can be sliced which should be a cheap operation. If one came in over 2^31 in length, it could be sliced into multiple segments.
* 'develop' of github.com:Kotlin/kotlinx-io: Publish Segment.size and Segment.remainingCapacity (Kotlin#409) Generate JPMS modules (Kotlin#406) Document empty bytestring factory (Kotlin#396) Update error message in `writableSegment` (Kotlin#398) Improve documentation (Kotlin#395)
Fixes #408