Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Implement zero copy byte buffers for &[u8] and &mut [u8] #2864

Copy link
Copy link

Description

@jhugman
Issue body actions

Following discussion in #2847 this issue is the MVP of zero copy buffers, with foreign owned byte arrays over synchronous calls.

The frontends already detect:

  • [ByRef] bytes in UDL
  • &[u8] in proc-macros.

The foreign language bindings represent this as:

  • Data for Swift
  • ByteBuffer for Kotlin — this is a change in behaviour.
  • bytes for Python

For arguments in async calls, this would revert to copying semantics.

For &mut [u8], this is slightly more involved:

  • Introduce a [ByMutRef] bytes annotation in UDL
  • Detect mutability in the proc macro, and error if async.
  • Introduce a LiftMutRef trait to correspond to the LiftRef trait.
  • alter the foreign language bindings:
    • inout Data for Swift
    • bytearray for Python

Without mutability, this would be more minimal, but non-viable.

Reactions are currently unavailable

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

    Morty Proxy This is a proxified and sanitized view of the page, visit original site.