mask-pii for Rust

Choose the Rust implementation of mask-pii to configure explicit email and phone masking before logging, auditing, or sharing data. The workflow remains easy to review.

Email masking rule

Keeps the domain visible while masking the local part, so addresses remain traceable without exposing full PII.

Phone masking rule

Masks middle digits while preserving the format and visible suffix for operational troubleshooting.

Safe-by-default configuration

Masking is opt-in: enable only the rules you need and choose a character that matches your log policy.

Install, use, and review the rollout checklist

Install the verified crates.io release, load the Rust API, and run the minimal example below. It enables both masking rules explicitly and records the expected output.

Installation

cargo add mask-pii@0.2.0

Usage

src/main.rs
use mask_pii::Masker;

fn main() {
    // Configure the masker
    let masker = Masker::new()
        .mask_emails()
        .mask_phones()
        .with_mask_char('#'); // Optional: Use '#' instead of '*'

    let input = "Contact: alice@example.com or 090-1234-5678.";
    
    // Process the text
    let output = masker.process(input);

    println!("{}", output);
    // Output: "Contact: a####@example.com or ###-####-5678."
}
README and implementation notes

For rollout details such as edge cases, test strategy, and language-specific caveats, review the README before production use.