deno_core icon indicating copy to clipboard operation
deno_core copied to clipboard

Add `fast` non-serde `ByteString` parameters

Open mmastrac opened this issue 1 year ago • 0 comments

We can make ByteStrings without using serde. While the slow path will require a scope, the fast path can make use of the *const u8 string that gets passed to the method.

At the same time, we should support #[string(onebyte)] &[u8] which could be a zero-copy version of ByteString that would be extremely useful for HTTP headers and values.

It would also make sense to add Cow and Vec parameters.

The following parameter types should be supported:

  • #[string(onebyte)] Cow<[u8]>
  • #[string(onebyte)] Vec<u8>
  • #[string(onebyte)] ByteString
  • #[string(onebyte)] &[u8]

Use of #[serde] ByteString should result in an error as users should migrate to one of the above forms.

mmastrac avatar Jul 31 '23 19:07 mmastrac