Skip to content

Add core conversion impls and optional interop with smol_str/compact_str#8

Draft
Copilot wants to merge 2 commits into
mainfrom
copilot/add-more-core-impls
Draft

Add core conversion impls and optional interop with smol_str/compact_str#8
Copilot wants to merge 2 commits into
mainfrom
copilot/add-more-core-impls

Conversation

Copilot AI commented Jun 17, 2026

Copy link
Copy Markdown

This PR expands CowStr/InlineStr interoperability by adding missing core conversion traits and feature-gated impls for widely used compact string crates. It keeps default behavior unchanged while enabling opt-in integrations.

  • Core trait coverage

    • Added AsRef<[u8]> for both CowStr and InlineStr.
    • Added From<Box<str>>, From<&String>, and From<InlineStr> for CowStr.
    • Added From<CowStr> for InlineStr.
  • Feature-gated popular crate interop

    • Introduced new optional features:
      • smol_strdep:smol_str
      • compact_strdep:compact_str
    • Added bidirectional conversions for both CowStr and InlineStr with:
      • smol_str::SmolStr
      • compact_str::CompactString
  • Docs and API surface updates

    • Updated crate-level feature docs and README to document new optional integrations.
  • Illustrative usage

    use moos::{CowStr, InlineStr};
    
    #[cfg(feature = "smol_str")]
    {
        let s = smol_str::SmolStr::new("abc");
        let cow = CowStr::from(s.clone());
        let back = smol_str::SmolStr::from(cow);
    
        let inline = InlineStr::from(s);
        let back2 = smol_str::SmolStr::from(inline);
    }
    
    #[cfg(feature = "compact_str")]
    {
        let s = compact_str::CompactString::from("abc");
        let cow = CowStr::from(s.clone());
        let back = compact_str::CompactString::from(cow);
    }

Copilot AI changed the title [WIP] Add more core implementations and feature-gated implementations for popular crates Add core conversion impls and optional interop with smol_str/compact_str Jun 17, 2026
Copilot AI requested a review from nberlette June 17, 2026 12:47
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.

2 participants