Skip to content

Conversation

@RAprogramm
Copy link
Owner

@RAprogramm RAprogramm commented Dec 17, 2025

Summary

  • Add Match enum with Exact and Partial variants for path matching strategy
  • Add partial prop to NavLink component for prefix-based matching
  • Update nav_link() function to require explicit Match parameter
  • Zero-allocation path segment comparison using iterators
  • Add Playwright E2E tests for all examples

Breaking Changes

  • nav_link() now requires Match as third parameter:
    // Before
    nav_link(Route::Home, "Home")
    
    // After
    nav_link(Route::Home, "Home", Match::Exact)
    nav_link(Route::Docs, "Docs", Match::Partial)

Usage

// Component syntax
<NavLink<Route> to={Route::Docs} partial=true>{ "Docs" }</NavLink<Route>>

// Function syntax
nav_link(Route::Docs, "Docs", Match::Partial)

Test plan

  • Unit tests for Match enum
  • Unit tests for path segment comparison
  • Doc tests
  • E2E tests for nested-routes example with partial matching

Closes #13

- Add Match enum (Exact, Partial) for path matching strategy
- Add partial prop to NavLink component
- Update nav_link() function to require explicit Match parameter
- Zero-allocation path segment comparison using iterators
- Breaking change: nav_link() now requires Match as third parameter
- Update examples, documentation, and README
- Bump version to 0.4.0
@github-actions
Copy link

github-actions bot commented Dec 17, 2025

Rust Diff Analysis

Tip

PR size is within limits. Good job keeping changes focused!

Limits — configured thresholds for this repository

Each metric is compared against its configured maximum. If any limit is exceeded, the PR check fails.

Metric Value Limit Status
Production Units 6 30
Weighted Score 14 100
Lines Added 73 100

Understanding the metrics:

  • Production Units: Functions, structs, enums, traits, and other semantic code units in production code
  • Weighted Score: Complexity score based on unit types (public APIs weigh more than private)
  • Lines Added: Raw count of new lines in production code
Summary — breakdown of changes by category

Production code counts toward limits. Test code is tracked but doesn't affect limits.

Metric Production Test
Functions 4 -
Structs/Enums 2 -
Other 0 -
Lines added +73 +146
Lines removed -65 -22
Total units 6 26
Production Changes — 6 units modified

Semantic units (functions, structs, etc.) that were added or modified in production code.

File Unit Type Changes
src/nav_link.rs:92-100 Match enum +9 -6
src/nav_link.rs:102-120 NavLinkProps struct +7 -10
src/nav_link.rs:122-170 NavLink function +10 -9
src/nav_link.rs:172-214 nav_link function +23 -22
src/nav_link.rs:216-241 is_path_prefix function +21 -16
src/nav_link.rs:243-250 build_class function +3 -2
Test Changes — 24 units modified

Test code changes don't count toward PR size limits.

File Unit Type Changes
src/nav_link.rs:252-470 tests module +23 -2
src/nav_link.rs:256-266 TestRoute enum +6 -1
src/nav_link.rs:269-272 match_default_is_exact function +4 -0
src/nav_link.rs:274-279 match_equality function +6 -0
src/nav_link.rs:281-285 match_debug function +5 -0
src/nav_link.rs:287-292 match_clone function +5 -1
src/nav_link.rs:300-303 build_class_inactive function +0 -1
src/nav_link.rs:306-321 props_equality_same function +3 -6
src/nav_link.rs:323-338 props_equality_different_route function +7 -8
src/nav_link.rs:340-355 props_equality_different_partial function +12 -0
src/nav_link.rs:357-368 props_debug function +5 -0
src/nav_link.rs:371-375 nav_link_exact_returns_html function +2 -0
src/nav_link.rs:377-381 nav_link_partial_returns_html function +3 -0
src/nav_link.rs:383-389 nav_link_different_routes function +5 -0
src/nav_link.rs:391-395 nav_link_empty_text function +2 -0
src/nav_link.rs:398-403 prefix_exact_match function +6 -0
src/nav_link.rs:406-411 prefix_valid function +6 -0
src/nav_link.rs:413-418 prefix_root_matches_all function +6 -0
src/nav_link.rs:421-426 prefix_not_prefix function +6 -0
src/nav_link.rs:428-433 prefix_segment_boundary function +6 -0
src/nav_link.rs:436-441 prefix_trailing_slashes function +6 -0
src/nav_link.rs:443-447 prefix_multiple_slashes function +5 -0
src/nav_link.rs:449-454 prefix_empty_paths function +6 -0
src/nav_link.rs:463-469 route_to_path function +7 -0
Analysis Scope

Analyzed: 4 Rust files

Skipped files:

  • 14 non-Rust files

Rust Diff Analyzer

@github-actions
Copy link

github-actions bot commented Dec 17, 2025

Cargo Quality Analysis

Tip

All quality checks passed. Code meets all standards!

Results — issues found by each analyzer

Each analyzer checks for specific code patterns. Zero issues means the check passed.

Analyzer Issues Status
path_import 0
format_args 0
empty_lines 0
inline_comments 0
Total 0
Analyzers — what each check does

These analyzers enforce consistent code style and best practices.

Analyzer Description How to fix
path_import Detects inline path imports like std::path::Path Use use statements at the top
format_args Detects format!("{}", x) patterns Use format!("{x}") syntax
empty_lines Detects empty lines inside function bodies Remove extra blank lines
inline_comments Detects // comment inside functions Move to doc comments or remove
Raw Output — detailed analysis log
error: unrecognized subcommand 'check'

Usage: cargo <COMMAND>

For more information, try '--help'.

Cargo Quality

@codecov
Copy link

codecov bot commented Dec 17, 2025

Codecov Report

❌ Patch coverage is 95.96774% with 5 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
src/nav_link.rs 95.96% 5 Missing ⚠️

📢 Thoughts on this report? Let us know!

@RAprogramm
Copy link
Owner Author

@rultor release 0.4.0

@rultor
Copy link
Collaborator

rultor commented Dec 17, 2025

@rultor release 0.4.0

@RAprogramm OK, I will release it now. Please check the progress here.

@rultor
Copy link
Collaborator

rultor commented Dec 17, 2025

@rultor release 0.4.0

@RAprogramm Oops, I failed. You can see the full log here (spent 1min).

++ dirname ./run.sh
+ cd .
+ echo 1784
+ echo '2.0-SNAPSHOT BUILD'
2.0-SNAPSHOT BUILD
+ date
Wed Dec 17 01:04:17 UTC 2025
+ uptime
 01:04:17 up 1 min,  0 users,  load average: 1.94, 0.52, 0.18
+ head=git@github.com:RAprogramm/yew-nav-link.git
+ ff=default
+ image=rust:1.91
+ rebase=false
+ squash=false
+ head_branch=main
+ author=raprogramm
+ vars=('--env=head=git@github.com:RAprogramm/yew-nav-link.git' '--env=scripts=( '\''export '\''\'\'''\''head=git@github.com:RAprogramm/yew-nav-link.git'\''\'\'''\'''\'' '\'';'\'' '\''export '\''\'\'''\''head_branch=main'\''\'\'''\'''\'' '\'';'\'' '\''export '\''\'\'''\''author=raprogramm'\''\'\'''\'''\'' '\'';'\'' '\''rustup toolchain install nightly'\'' '\'';'\'' '\''rustup component add rustfmt --toolchain nightly'\'' '\'';'\'' '\''sed -i "s/^version = .*/version = \"${tag}\"/" Cargo.toml'\'' '\'';'\'' '\''cargo +nightly fmt --all'\'' '\'';'\'' '\''cargo check --all-features'\'' '\'';'\'' '\''git commit -am "Release ${tag}"'\'' '\'';'\'' )' '--env=head_branch=main' '--env=author=raprogramm')
+ scripts=('export '\''head=git@github.com:RAprogramm/yew-nav-link.git'\''' ';' 'export '\''head_branch=main'\''' ';' 'export '\''author=raprogramm'\''' ';' 'rustup toolchain install nightly' ';' 'rustup component add rustfmt --toolchain nightly' ';' 'sed -i "s/^version = .*/version = \"${tag}\"/" Cargo.toml' ';' 'cargo +nightly fmt --all' ';' 'cargo check --all-features' ';' 'git commit -am "Release ${tag}"' ';')
+ directory=
+ container=raprogramm_yew-nav-link_14
+ as_root=false
+ set -e -o pipefail
+ hostname
ip-172-31-22-201
+ pwd
/tmp/rultor-RTgr
+ git --version
git version 2.34.1
+ docker --version
Docker version 25.0.3, build 4debf41
+ mkdir -p /home/ubuntu/.ssh
+ echo -e 'Host github.com\n\tStrictHostKeyChecking no\n'
+ chmod 600 /home/ubuntu/.ssh/config
+ git clone --recurse-submodules git@github.com:RAprogramm/yew-nav-link.git repo
Cloning into 'repo'...
Warning: Permanently added 'github.com' (ED25519) to the list of known hosts.
+ cd repo
+ git config user.email gpg@rultor.com
+ git config user.name Rultor.com
+ '[' -z 'export '\''head=git@github.com:RAprogramm/yew-nav-link.git'\''' ']'
+ cd ..
+ cat
+ '[' false = true ']'
+ cat
+ chmod a+x entry.sh
+ cat
+ echo 'export '\''head=git@github.com:RAprogramm/yew-nav-link.git'\''' ';' 'export '\''head_branch=main'\''' ';' 'export '\''author=raprogramm'\''' ';' 'rustup toolchain install nightly' ';' 'rustup component add rustfmt --toolchain nightly' ';' 'sed -i "s/^version = .*/version = \"${tag}\"/" Cargo.toml' ';' 'cargo +nightly fmt --all' ';' 'cargo check --all-features' ';' 'git commit -am "Release ${tag}"' ';'
+ sensitive=()
+ set -ex -o pipefail
+ '[' -z '' ']'
+ echo 'tag name is not provided in the request, see http://doc.rultor.com/basics.html'
tag name is not provided in the request, see http://doc.rultor.com/basics.html
+ exit 1
'cid' file is absent, most probably the Docker container wasn't started correctly

@RAprogramm
Copy link
Owner Author

@rultor release, tag=0.4.0

@rultor
Copy link
Collaborator

rultor commented Dec 17, 2025

@rultor release, tag=0.4.0

@RAprogramm OK, I will release it now. Please check the progress here.

@rultor
Copy link
Collaborator

rultor commented Dec 17, 2025

@rultor release, tag=0.4.0

@RAprogramm Oops, I failed. You can see the full log here (spent 1min).

dd420cee8193: Verifying Checksum
dd420cee8193: Download complete
2981f7e8980b: Pull complete
b22766554d6b: Pull complete
58f2d358b447: Pull complete
dd420cee8193: Pull complete
338b1467c232: Pull complete
Digest: sha256:867f1d1162913c401378a8504fb17fe2032c760dc316448766f150a130204aad
Status: Downloaded newer image for rust:1.91
docker.io/library/rust:1.91
+ grep --quiet '\sraprogramm_yew-nav-link_14\s*$'
+ docker ps --filter=status=exited
+ ls -al .
total 44
drwx------  3 ubuntu ubuntu 4096 Dec 17 01:10 .
drwxrwxrwt 12 root   root   4096 Dec 17 01:09 ..
-rwxrwxr-x  1 ubuntu ubuntu  666 Dec 17 01:09 end.sh
-rwxrwxr-x  1 ubuntu ubuntu  498 Dec 17 01:10 entry.sh
-rw-rw-r--  1 ubuntu ubuntu    5 Dec 17 01:09 pid
drwxrwxr-x  9 ubuntu ubuntu 4096 Dec 17 01:10 repo
-rwxrwxr-x  1 ubuntu ubuntu 6260 Dec 17 01:09 run.sh
-rw-rw-r--  1 ubuntu ubuntu  560 Dec 17 01:10 script.sh
-rw-rw-r--  1 ubuntu ubuntu 4448 Dec 17 01:10 stdout
++ pwd
++ pwd
+ docker run -t --rm -v /tmp/rultor-CHkS:/main --env=head=git@github.com:RAprogramm/yew-nav-link.git --env=tag=0.4.0 '--env=scripts=( '\''export '\''\'\'''\''head=git@github.com:RAprogramm/yew-nav-link.git'\''\'\'''\'''\'' '\'';'\'' '\''export '\''\'\'''\''tag=0.4.0'\''\'\'''\'''\'' '\'';'\'' '\''export '\''\'\'''\''head_branch=main'\''\'\'''\'''\'' '\'';'\'' '\''export '\''\'\'''\''author=raprogramm'\''\'\'''\'''\'' '\'';'\'' '\''rustup toolchain install nightly'\'' '\'';'\'' '\''rustup component add rustfmt --toolchain nightly'\'' '\'';'\'' '\''sed -i "s/^version = .*/version = \"${tag}\"/" Cargo.toml'\'' '\'';'\'' '\''cargo +nightly fmt --all'\'' '\'';'\'' '\''cargo check --all-features'\'' '\'';'\'' '\''git commit -am "Release ${tag}"'\'' '\'';'\'' )' --env=head_branch=main --env=author=raprogramm --hostname=docker --privileged --net=host --dns 8.8.8.8 --add-host docker:127.0.0.1 --memory=8g --memory-swap=16g --oom-kill-disable --cidfile=/tmp/rultor-CHkS/cid -w=/main -v /var/run/docker.sock:/var/run/docker.sock --name=raprogramm_yew-nav-link_14 rust:1.91 /main/entry.sh
WARNING: Your kernel does not support OomKillDisable. OomKillDisable discarded.
+ set -e
+ set -o pipefail
+ shopt -s dotglob
+ useradd -m -G sudo r
++ awk -F : '$3 > 100 { print $1 }'
++ cat /etc/group
+ for g in $(cat /etc/group | awk -F ':' '$3 > 100 { print $1 }')
+ usermod -a -G nogroup r
+ for g in $(cat /etc/group | awk -F ':' '$3 > 100 { print $1 }')
+ usermod -a -G _ssh r
+ for g in $(cat /etc/group | awk -F ':' '$3 > 100 { print $1 }')
+ usermod -a -G r r
+ usermod -s /bin/bash r
+ echo '%sudo ALL=(ALL) NOPASSWD:ALL'
+ cp -R /root/.bashrc /root/.profile /home/r
+ cp -R ./cid ./end.sh ./entry.sh ./pid ./repo ./run.sh ./script.sh ./stdout /home/r
+ rm -rf repo
+ chown -R r:r /home/r
+ chmod a+x /home/r/script.sh
+ cat /home/r/script.sh
#!/usr/bin/env bash
set -e
set -o pipefail
if [ -e /home/r/.profile ]; then source /home/r/.profile; fi
shopt -s expand_aliases
alias 'sudo=sudo -i'
export HOME=/home/r
cd "${HOME}/repo"
export 'head=git@github.com:RAprogramm/yew-nav-link.git' ; export 'tag=0.4.0' ; export 'head_branch=main' ; export 'author=raprogramm' ; rustup toolchain install nightly ; rustup component add rustfmt --toolchain nightly ; sed -i "s/^version = .*/version = \"${tag}\"/" Cargo.toml ; cargo +nightly fmt --all ; cargo check --all-features ; git commit -am "Release ${tag}" ;
+ su --login r --command /home/r/script.sh
/home/r/script.sh: line 9: rustup: command not found
container 809e6c2c70b267c1d5166e9525b261bee72f4ce11431522c8eea9b2f039cd790 is dead
Wed Dec 17 01:11:03 UTC 2025

@RAprogramm
Copy link
Owner Author

@rultor release, tag=0.4.0

@rultor
Copy link
Collaborator

rultor commented Dec 17, 2025

@rultor release, tag=0.4.0

@RAprogramm OK, I will release it now. Please check the progress here.

@rultor
Copy link
Collaborator

rultor commented Dec 17, 2025

@rultor release, tag=0.4.0

@RAprogramm Oops, I failed. You can see the full log here (spent 1min).

338b1467c232: Verifying Checksum
338b1467c232: Download complete
2981f7e8980b: Pull complete
b22766554d6b: Pull complete
58f2d358b447: Pull complete
dd420cee8193: Pull complete
338b1467c232: Pull complete
Digest: sha256:867f1d1162913c401378a8504fb17fe2032c760dc316448766f150a130204aad
Status: Downloaded newer image for rust:1.91
docker.io/library/rust:1.91
+ docker ps --filter=status=exited
+ grep --quiet '\sraprogramm_yew-nav-link_14\s*$'
+ ls -al .
total 44
drwx------  3 ubuntu ubuntu 4096 Dec 17 01:15 .
drwxrwxrwt 12 root   root   4096 Dec 17 01:15 ..
-rwxrwxr-x  1 ubuntu ubuntu  666 Dec 17 01:15 end.sh
-rwxrwxr-x  1 ubuntu ubuntu  498 Dec 17 01:15 entry.sh
-rw-rw-r--  1 ubuntu ubuntu    5 Dec 17 01:15 pid
drwxrwxr-x  9 ubuntu ubuntu 4096 Dec 17 01:15 repo
-rwxrwxr-x  1 ubuntu ubuntu 6260 Dec 17 01:15 run.sh
-rw-rw-r--  1 ubuntu ubuntu  560 Dec 17 01:15 script.sh
-rw-rw-r--  1 ubuntu ubuntu 4447 Dec 17 01:16 stdout
++ pwd
++ pwd
+ docker run -t --rm -v /tmp/rultor-cy0K:/main --env=head=git@github.com:RAprogramm/yew-nav-link.git --env=tag=0.4.0 '--env=scripts=( '\''export '\''\'\'''\''head=git@github.com:RAprogramm/yew-nav-link.git'\''\'\'''\'''\'' '\'';'\'' '\''export '\''\'\'''\''tag=0.4.0'\''\'\'''\'''\'' '\'';'\'' '\''export '\''\'\'''\''head_branch=main'\''\'\'''\'''\'' '\'';'\'' '\''export '\''\'\'''\''author=raprogramm'\''\'\'''\'''\'' '\'';'\'' '\''rustup toolchain install nightly'\'' '\'';'\'' '\''rustup component add rustfmt --toolchain nightly'\'' '\'';'\'' '\''sed -i "s/^version = .*/version = \"${tag}\"/" Cargo.toml'\'' '\'';'\'' '\''cargo +nightly fmt --all'\'' '\'';'\'' '\''cargo check --all-features'\'' '\'';'\'' '\''git commit -am "Release ${tag}"'\'' '\'';'\'' )' --env=head_branch=main --env=author=raprogramm --hostname=docker --privileged --net=host --dns 8.8.8.8 --add-host docker:127.0.0.1 --memory=8g --memory-swap=16g --oom-kill-disable --cidfile=/tmp/rultor-cy0K/cid -w=/main -v /var/run/docker.sock:/var/run/docker.sock --name=raprogramm_yew-nav-link_14 rust:1.91 /main/entry.sh
WARNING: Your kernel does not support OomKillDisable. OomKillDisable discarded.
+ set -e
+ set -o pipefail
+ shopt -s dotglob
+ useradd -m -G sudo r
++ awk -F : '$3 > 100 { print $1 }'
++ cat /etc/group
+ for g in $(cat /etc/group | awk -F ':' '$3 > 100 { print $1 }')
+ usermod -a -G nogroup r
+ for g in $(cat /etc/group | awk -F ':' '$3 > 100 { print $1 }')
+ usermod -a -G _ssh r
+ for g in $(cat /etc/group | awk -F ':' '$3 > 100 { print $1 }')
+ usermod -a -G r r
+ usermod -s /bin/bash r
+ echo '%sudo ALL=(ALL) NOPASSWD:ALL'
+ cp -R /root/.bashrc /root/.profile /home/r
+ cp -R ./cid ./end.sh ./entry.sh ./pid ./repo ./run.sh ./script.sh ./stdout /home/r
+ rm -rf repo
+ chown -R r:r /home/r
+ chmod a+x /home/r/script.sh
+ cat /home/r/script.sh
#!/usr/bin/env bash
set -e
set -o pipefail
if [ -e /home/r/.profile ]; then source /home/r/.profile; fi
shopt -s expand_aliases
alias 'sudo=sudo -i'
export HOME=/home/r
cd "${HOME}/repo"
export 'head=git@github.com:RAprogramm/yew-nav-link.git' ; export 'tag=0.4.0' ; export 'head_branch=main' ; export 'author=raprogramm' ; rustup toolchain install nightly ; rustup component add rustfmt --toolchain nightly ; sed -i "s/^version = .*/version = \"${tag}\"/" Cargo.toml ; cargo +nightly fmt --all ; cargo check --all-features ; git commit -am "Release ${tag}" ;
+ su --login r --command /home/r/script.sh
/home/r/script.sh: line 9: rustup: command not found
container 6e88d9223f4dea82266fcaf2e765298d5b3a6450dfdbeafb33cdf3e17c8cfa76 is dead
Wed Dec 17 01:16:40 UTC 2025

@RAprogramm RAprogramm merged commit 8723c6b into main Dec 17, 2025
10 checks passed
@RAprogramm RAprogramm deleted the 13 branch December 17, 2025 01:20
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.

NavLink does not support prefix matching for nested routes

2 participants