Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This change adds specifically, support for
&[u8]
with a correspondingrust::Slice<uint8_t>
type. No other types of slice are permitted. Therationale is that it may be common to pass binary data back and forth
across the FFI boundary, so it's more urgent to get this in place sooner.
Broader support for other slices can wait for the future.
But, both C and Rust-side bindings should allow the existing support
to be broadened to other Slice types in future without code changes.
A few specific notes:
rust::Slice
might be better asrust::SliceRef
but I'mfollowing the precedent of
rust::Str
.std::span
but as that'sa C 20 feature, that may have to wait until C feature detection
is resolved. Meanwhile,
rust::Slice<uint8_t>
can be constructedfrom a raw pointer and a length.
&str
, where the parser willinitially recognize this as
Type::Ref
(ofType::Slice
) but thenwill replace that with
Type::SliceRefU8
. Type::Slice should notpersist through later stages. As we later come to support other
types of slice, we would probably want to remove
Type::SliceRefU8
.