Skip to content

remote-derive: support owning string and bytes constructors - #812

Open
rsd-darshan wants to merge 1 commit into
anthropics:mainfrom
rsd-darshan:feat/remote-derive-constructors
Open

rsd-darshan wants to merge 1 commit into
anthropics:mainfrom
rsd-darshan:feat/remote-derive-constructors

Conversation

@rsd-darshan

Copy link
Copy Markdown
Contributor

Closes #630.

Remote string types whose From<&str> borrows or accepts only static strings could not use derive(ProtoString), and remote bytes wrappers always copied their wire payloads.

  • Add copy_from_str = path to ProtoString, using the owning constructor for From<&str>, copy_from_str, and UTF-8-validated wire decoding.
  • Add from_bytes = path to ProtoBytes, constructing from WirePayload::into_bytes() and setting PREFERS_OWNED_PAYLOAD = true so Bytes-backed input can share its allocation.
  • Preserve existing defaults, owned conversions, and the independent as_shared hook. Document input-buffer retention and add a changelog fragment.

Validation:

  • New constructor fixtures fail to compile before the change because the attributes are unsupported.
  • Regression coverage includes non-static string inputs, invalid UTF-8, tuple/named wrappers, allocation identity through runtime decoding, borrowed input, invalid attributes, and serde/arbitrary compatibility.
  • task lint passes.
  • task test passes (4,328 tests passed; 206 ignored).

No buffa-codegen output or checked-in generated types change.

Add copy_from_str and from_bytes overrides while preserving existing defaults. Route owned byte payloads through the requested constructor and opt into shared input decoding. Cover constructor dispatch, ownership, UTF-8 validation, and existing forwarders with regression tests.
@github-actions

Copy link
Copy Markdown

All contributors have signed the CLA ✍️ ✅
Posted by the CLA Assistant Lite bot.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

remote-derive: override keys for an owning string constructor on ProtoString and an owned-payload constructor on ProtoBytes

1 participant