Skip to content

Conversation

@mxsm
Copy link
Owner

@mxsm mxsm commented Jan 5, 2026

fix #86

Summary by CodeRabbit

  • New Features
    • Added three new character-based predicate methods: starts_with_char(), ends_with_char(), and contains_char() for checking strings by individual characters.
    • Added example demonstrating the new character-based predicates alongside existing string-based methods.

✏️ Tip: You can customize this high-level summary in your review settings.

Copilot AI review requested due to automatic review settings January 5, 2026 15:14
@coderabbitai
Copy link

coderabbitai bot commented Jan 5, 2026

📝 Walkthrough

Walkthrough

This PR adds three new character-based predicate methods to CheetahString (starts_with_char, ends_with_char, contains_char) and includes a new example file demonstrating their usage alongside existing string-based methods.

Changes

Cohort / File(s) Summary
New Example File
examples/char_methods.rs
New example file demonstrating character-based predicates on CheetahString, showcasing starts_with_char(), ends_with_char(), contains_char() alongside existing string-based variants
Character Methods Implementation
src/cheetah_string.rs
Three new public methods added: starts_with_char(char) -> bool, ends_with_char(char) -> bool, contains_char(char) -> bool; each delegates to the corresponding &str predicate method

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Poem

A rabbit hops with glee so bright, 🐰
New char methods, oh what a sight!
Starts and ends and holds them true,
CheetahString now swift and new!
Character checks, fast as can be—
Simple, elegant, and fancy-free! ✨

Pre-merge checks and finishing touches

✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly identifies the main change: adding three character-based methods to CheetahString, matching the linked issue #86.
Linked Issues check ✅ Passed The PR successfully implements all three required methods (starts_with_char, ends_with_char, contains_char) as specified in issue #86.
Out of Scope Changes check ✅ Passed All changes are directly related to implementing the character-based methods requested in issue #86; no out-of-scope modifications detected.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
✨ Finishing touches
  • 📝 Generate docstrings

📜 Recent review details

Configuration used: defaults

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 7d48abb and 9239193.

📒 Files selected for processing (2)
  • examples/char_methods.rs
  • src/cheetah_string.rs
🧰 Additional context used
🧬 Code graph analysis (1)
examples/char_methods.rs (1)
src/cheetah_string.rs (18)
  • from (30-32)
  • from (37-39)
  • from (44-46)
  • from (58-62)
  • from (82-86)
  • from (91-96)
  • from (101-106)
  • from (120-122)
  • from (163-165)
  • from (170-172)
  • from (177-208)
  • from (243-245)
  • starts_with_char (483-485)
  • ends_with_char (515-517)
  • contains_char (547-549)
  • starts_with (467-469)
  • ends_with (499-501)
  • contains (531-533)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: Agent
🔇 Additional comments (4)
src/cheetah_string.rs (3)

471-485: LGTM! Clean implementation of character-based predicate.

The method correctly delegates to str::starts_with(char) and provides a clear, ergonomic API for character-based checks. Documentation includes helpful examples.


503-517: LGTM! Consistent implementation.

The method correctly delegates to str::ends_with(char) and follows the same pattern as starts_with_char. Documentation is clear and complete.


535-549: LGTM! Completes the character-based predicate API.

The method correctly delegates to str::contains(char) and maintains consistency with the other two character-based methods. The implementation is clean and well-documented.

examples/char_methods.rs (1)

1-22: LGTM! Excellent example demonstrating the new API.

The example clearly demonstrates all three new character-based methods with both positive and negative test cases. The comparison with existing string-based methods (lines 18-21) helps users understand when to use each approach. Well-structured and educational.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds three new character-based convenience methods to CheetahString that provide more ergonomic ways to check for single characters compared to the existing string-based methods. These methods delegate directly to Rust's standard library str methods that accept char parameters.

Key Changes:

  • Added starts_with_char, ends_with_char, and contains_char methods that accept char parameters
  • Included comprehensive inline documentation with examples for each new method
  • Added an example file demonstrating usage of all three new methods

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.

File Description
src/cheetah_string.rs Implements three new character-checking methods (starts_with_char, ends_with_char, contains_char) with inline documentation and usage examples
examples/char_methods.rs Demonstrates usage of the new character-based methods alongside the existing string-based methods

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@mxsm mxsm merged commit 2f00aeb into main Jan 5, 2026
13 checks passed
@mxsm mxsm deleted the feat-86 branch January 6, 2026 07:17
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.

Add character-based methods to CheetahString: starts_with_char, ends_with_char, and contains_char

3 participants