| FetchBackend.kt |
|
2966 |
| Helpers.kt |
A helper for converting a protobuf Message into a direct `java.nio.ByteBuffer`
and its length. This avoids a copy when passing data to Rust, when compared
to using an `Array<Byte>`
|
12368 |
| HttpConfig.kt |
All errors emitted by the client will subclass this.
|
7121 |
| LibViaduct.kt |
|
1295 |
| RustBuffer.kt |
This is a mapping for the `ffi_support::ByteBuffer` struct.
The name differs for two reasons.
1. To that the memory this type manages is allocated from rust code,
and must subsequently be freed by rust code.
2. To avoid confusion with java's nio ByteBuffer, which we use for
passing data *to* Rust without incurring additional copies.
# Caveats:
1. It is for receiving data *FROM* Rust, and not the other direction.
RustBuffer doesn't expose a way to inspect its contents from Rust.
See `docs/howtos/passing-protobuf-data-over-ffi.md` for how to do
this instead.
2. A `RustBuffer` passed into kotlin code must be freed by kotlin
code *after* the protobuf message is completely deserialized.
The rust code must expose a destructor for this purpose,
and it should be called in the finally block after the data
is read from the `CodedInputStream` (and not before).
3. You almost always should use `RustBuffer.ByValue` instead
of `RustBuffer`. E.g.
`fun mylib_get_stuff(some: X, args: Y): RustBuffer.ByValue`
for the function returning the RustBuffer, and
`fun mylib_destroy_bytebuffer(bb: RustBuffer.ByValue)`.
|
3306 |