pub fn international_prefix<'a>(idd: Option<&CachedRegex>, mut number: Number<'a>) -> Number<'a> {
	// If there's a prefix already, i.e. RFC3966, just change the country source.
	if number.prefix.is_some() {
		number.country = country::Source::Plus;
		return normalize(number, &consts::ALPHA_PHONE_MAPPINGS);
	}

	// Ignore any leading PLUS characters.
	let start = ignore_plus(&number.national)
		.map(|(_,s)| s.len()) ////YANN: CHECK
		.unwrap_or(0);

	// If there are any pluses, strip them and change the country source.
	if start != 0 {
		number.country  = country::Source::Plus;
		number.national = trim(number.national, start);
		number          = normalize(number, &consts::ALPHA_PHONE_MAPPINGS);

		if !idd.and_then(|re| re.find(&number.national)).map(|m| m.start() == 0).unwrap_or(false) {
			return number;
		}
	}
	else {
		number.country = country::Source::Default;
		number         = normalize(number, &consts::ALPHA_PHONE_MAPPINGS);
	}

	// Check if the IDD pattern matches.
	let index = idd.and_then(|re| re.find(&number.national))
		.map(|m| (m.start(), m.end()));

	// If it does.
	if let Some((start, end)) = index {
		// Check it starts at the beginning and the next digit after the IDD is not
		// a 0, since that's invalid.
		if start == 0 && !number.national[end ..].starts_with('0') {
			if number.country != country::Source::Plus {
				number.country = country::Source::Idd;
			}

			number.national = trim(number.national, end);
		}
	}

	number
}
/// Strip the IDD from a `Number`, update the country code source, and
/// normalize it.
///
/// Note that since the IDD comes from a passed default region, we can find the
/// country code from the given default if the country source is from the IDD.
Strip the IDD from a `Number`, update the country code source, and
normalize it.

Note that since the IDD comes from a passed default region, we can find the
country code from the given default if the country source is from the IDD.
Strip the IDD from a ` Number ` update the country code source and normalize it . Note that since the IDD comes from a passed default region we can find the country code from the given default if the country source is from the IDD .
pub fn international_prefix<'a>(idd: Option<&CachedRegex>, mut number: Number<'a>) -> Number<'a> {
	// If there's a prefix already, i.e. RFC3966, just change the country source.
	if number.prefix.is_some() {
		number.country = country::Source::Plus;
		return normalize(number, &consts::ALPHA_PHONE_MAPPINGS);
	}
	// Ignore any leading PLUS characters.
	let start = ignore_plus(&number.national)
		.map(|(_,s)| s.len()) ////YANN: CHECK
		.unwrap_or(0);
	// If there are any pluses, strip them and change the country source.
	if start != 0 {
		number.country  = country::Source::Plus;
		number.national = trim(number.national, start);
		number          = normalize(number, &consts::ALPHA_PHONE_MAPPINGS);
		if !idd.and_then(|re| re.find(&number.national)).map(|m| m.start() == 0).unwrap_or(false) {
			return number;
		}
	}
	else {
		number.country = country::Source::Default;
		number         = normalize(number, &consts::ALPHA_PHONE_MAPPINGS);
	}
	// Check if the IDD pattern matches.
	let index = idd.and_then(|re| re.find(&number.national))
		.map(|m| (m.start(), m.end()));
	// If it does.
	if let Some((start, end)) = index {
		// Check it starts at the beginning and the next digit after the IDD is not
		// a 0, since that's invalid.
		if start == 0 && !number.national[end ..].starts_with('0') {
			if number.country != country::Source::Plus {
				number.country = country::Source::Idd;
			}
			number.national = trim(number.national, end);
		}
	}
	number
}
pub fn international_prefix < ' a > ( idd : Option < & CachedRegex > , mut number : Number < ' a > ) -> Number < ' a > { // If there's a prefix already, i.e. RFC3966, just change the country source. if number . prefix . is_some ( ) { number . country = country :: Source :: Plus ; return normalize ( number , & consts :: ALPHA_PHONE_MAPPINGS ) ; } // Ignore any leading PLUS characters. let start = ignore_plus ( & number . national ) . map ( | ( _ , s ) | s . len ( ) ) ////YANN: CHECK . unwrap_or ( 0 ) ; // If there are any pluses, strip them and change the country source. if start != 0 { number . country = country :: Source :: Plus ; number . national = trim ( number . national , start ) ; number = normalize ( number , & consts :: ALPHA_PHONE_MAPPINGS ) ; if ! idd . and_then ( | re | re . find ( & number . national ) ) . map ( | m | m . start ( ) == 0 ) . unwrap_or ( false ) { return number ; } } else { number . country = country :: Source :: Default ; number = normalize ( number , & consts :: ALPHA_PHONE_MAPPINGS ) ; } // Check if the IDD pattern matches. let index = idd . and_then ( | re | re . find ( & number . national ) ) . map ( | m | ( m . start ( ) , m . end ( ) ) ) ; // If it does. if let Some ( ( start , end ) ) = index { // Check it starts at the beginning and the next digit after the IDD is not // a 0, since that's invalid. if start == 0 && ! number . national [ end .. ] . starts_with ( '0' ) { if number . country != country :: Source :: Plus { number . country = country :: Source :: Idd ; } number . national = trim ( number . national , end ) ; } } number }
Strip the IDD from a `Number`, update the country code source, and
normalize it.
Strip the IDD from a ` Number ` update the country code source and normalize it .
idd
Option<&CachedRegex>
number
Number<'a>