Skip to content

feat: add LazyValue::as_cow_str#217

Open
utkarshgupta137 wants to merge 1 commit intocloudwego:mainfrom
utkarshgupta137:main
Open

feat: add LazyValue::as_cow_str#217
utkarshgupta137 wants to merge 1 commit intocloudwego:mainfrom
utkarshgupta137:main

Conversation

@utkarshgupta137
Copy link
Contributor

What type of PR is this?

feat

Check the PR title.

  • This PR title match the format: <type>(optional scope): <description>
  • The description of this PR title is user-oriented and clear enough for others to understand.
  • Attach the PR updating the user documentation if the current PR requires user awareness at the usage level. User docs repo

More detailed description for this PR.

Add LazyValue::as_cow_str to support zero-copy get.

Currently, sonic-rs::get returns LazyValue, but LazyValue::as_str returns &str which is tied to the lifetime of the LazyValue reference instead of the input. This means that even if there are no escapes, we've to copy the str to return the value. LazyValue::as_cow_str returns a Cow<'a, str> which is tied to the lifetime of the input.

@CLAassistant
Copy link

CLAassistant commented Mar 3, 2026

CLA assistant check
All committers have signed the CLA.

@liuq19
Copy link
Collaborator

liuq19 commented Mar 18, 2026

@codex

@codecov
Copy link

codecov bot commented Mar 18, 2026

Codecov Report

❌ Patch coverage is 0% with 13 lines in your changes missing coverage. Please review.
✅ Project coverage is 69.87%. Comparing base (32668d6) to head (1a2ee6c).

Files with missing lines Patch % Lines
src/lazyvalue/value.rs 0.00% 13 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #217      +/-   ##
==========================================
- Coverage   69.97%   69.87%   -0.10%     
==========================================
  Files          42       42              
  Lines        9917     9930      +13     
==========================================
  Hits         6939     6939              
- Misses       2978     2991      +13     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@chatgpt-codex-connector
Copy link

Codex Review: Didn't find any major issues. Bravo.

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

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

Labels

None yet

Development

Successfully merging this pull request may close these issues.

3 participants