MCPcopy Create free account
hub / github.com/ddd/gpb / PhoneNumberGenerator

Class PhoneNumberGenerator

src/format/format.rs:120–132  ·  view source on GitHub ↗

First, let's modify the PhoneNumberGenerator struct to add the infix field

Source from the content-addressed store, hash-verified

118
119// First, let's modify the PhoneNumberGenerator struct to add the infix field
120pub struct PhoneNumberGenerator {
121 country_code: String, // Country calling code (e.g., "1" for US, "65" for SG)
122 selected_area_codes: Vec<String>, // Selected area codes based on prefix filter
123 digits_per_number: usize, // Number of digits to generate after country+area code
124 prefix: Option<String>, // User-specified prefix (may override or extend area code)
125 suffix_filter: Option<String>, // Numbers must end with this suffix
126 infix_filter: Option<String>, // Numbers must have this infix at specific position from the end
127 current_area_code_idx: usize, // Current area code index
128 current_number: u64, // Current number in sequence
129 max_numbers_per_segment: u64, // Maximum numbers per segment
130 has_more: bool, // Whether more numbers can be generated
131 remaining_area_code_parts: Vec<String>, // Remaining parts of area codes after partial prefix match
132}
133
134// Now modify the new() method to accept an infix parameter
135impl PhoneNumberGenerator {

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected