PII masking for logs and pipelines in Rust.

Mask email addresses and global phone numbers safely, quickly, and with minimal dependencies. Designed for logging and data processing workflows.

Email Masking

Preserves the domain and the first local character: alice@example.com -> a****@example.com.

Global Phone Formats

Keeps formatting and the last 4 digits: +1 (800) 123-4567 -> +1 (***) ***-4567.

Custom & Lightweight

Change the mask character and keep dependencies minimal (regex only).

Installation & Basic Usage

Rust [published: crates.io 0.2.0]: ใช้วิธีติดตั้งปัจจุบันด้านล่าง โหลด API ของ Rust แล้วเรียกใช้ตัวอย่างขั้นต่ำ ตัวอย่างนี้เปิดใช้การปกปิดอีเมลและโทรศัพท์อย่างชัดเจนและแสดงผลลัพธ์ที่คาดไว้

การติดตั้ง

cargo add mask-pii@0.2.0

การใช้งาน

src/main.rs
use mask_pii::Masker;

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

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

  println!("{}", output);
  // Output: "Contact: a####@example.com or 090-####-5678."
}
Important Note

By default, README performs no masking. Enable email/phone filters explicitly before processing text.

ก่อนหน้า

Language index

ถัดไป

GitHub (Rust)