mask
Hides a secret but for its last few characters, such as "****************7890".
Every character except the last visible becomes *. To be safe with short secrets, at most a
quarter of the characters are ever shown, whatever visible asks for, so an 8-character
password shows at most 2. The length of the result equals the length of the secret in characters.
Import
Section titled “Import”Cargo feature secret (enabled by default). To compile only this module:
or in Cargo.toml:
Signature
Section titled “Signature”Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
secret | &str | The value to mask. |
visible | usize | How many trailing characters to keep, at most a quarter of the secret. |
Returns
Section titled “Returns”String — The masked value.
