Skip to content

docs: add a runnable example to Screen::mask_matching - #551

Merged
vyncint merged 1 commit into
vyncint:mainfrom
cestercian:docs/mask-matching-doctest
Oct 2, 2026
Merged

vyncint merged 1 commit into
vyncint:mainfrom
cestercian:docs/mask-matching-doctest

Conversation

@cestercian

Copy link
Copy Markdown
Contributor

What & why

mask_matching explains why masking keeps the grid's width, but nothing compiles an example of it (the README one is rust,ignore). This adds a PTY-free doctest: parse a one-row screen with a clock, mask 12:34:56 with #, and assert both the masked text (Build ######## ok) and that the size did not change. Docs only, no signature changes.

Closes #543

Checklist

  • Linked an issue (or explained above why none exists)
  • Tests added/updated for the change (the doctest is the change)
  • cargo fmt --all and cargo clippy --workspace --all-targets --all-features are clean
  • All commits are signed off (git commit -s)
  • No AI attribution trailers
  • CHANGELOG.md updated under [Unreleased] (user-facing changes only): n/a, doc comment only
  • Snapshot changes (if any) were reviewed with cargo insta review, not blind-accepted: n/a

cargo test --doc -p termlens mask_matching and RUSTDOCFLAGS='-D warnings' cargo doc --no-deps pass.

mask_rect, mask_matching and mask_cells explain why they mask the grid and not the text, but none had an example that compiles. Add a PTY-free doctest on mask_matching: parse a one-row screen, mask the clock with a visible fill, and assert both the text and that the size did not change.

Signed-off-by: Cestercian <183791452+cestercian@users.noreply.github.com>
@cestercian
cestercian requested a review from vyncint as a code owner October 1, 2026 19:31
@vyncint
vyncint merged commit ca22b26 into vyncint:main Oct 2, 2026
16 checks passed
@vyncint vyncint mentioned this pull request Oct 7, 2026
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.

docs: give the mask methods a runnable example

2 participants