[gen] Nickname parts that survive title edits (v0.1.1) #2
Reference in New Issue
Block a user
Delete Branch "feature/nickname-parts"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Lets a new web login's nickname follow its title as it is typed without drawing a new word and number on
every keystroke.
What
custos-gen:nickname_parts(&opts) -> NicknameParts { words, numbers, entropy_bits }draws the randomparts once;
NicknameParts::render(title, template)fills in{Name}(same rules: diacritics stripped,PascalCase, ≤ 20 chars, dropped with its separator when empty).
nickname()is now parts + render, so itsbehaviour and entropy are unchanged.
Tests
cargo test --workspace --release: custos-gen 15 passed (one new: the same parts rendered for "", "G","Gi", "GitHub" keep word and number, and a template with more tokens than parts is refused),
custos-vault 10 passed, doctest 1 passed. Total 26, 0 failed.
Self-review
rendertakes the template again rather than storing it; a caller that changes the template betweendrawing and rendering gets an error when the token counts differ, not a silently wrong nickname. If only
literals change, the new literals are used — intended (the settings dialog can preview a template edit).