Refactor exports and imports

This commit is contained in:
Vlasislav Kashin
2025-07-13 21:24:52 +03:00
parent 7f7bab7f16
commit 76a8d4857f
6 changed files with 36 additions and 42 deletions

View File

@@ -13,7 +13,7 @@
// See the License for the specific language governing permissions and // See the License for the specific language governing permissions and
// limitations under the License. // limitations under the License.
use crate::PhoneNumberDesc; use crate::generated::proto::phonemetadata::PhoneNumberDesc;
/// Internal phonenumber matching API used to isolate the underlying /// Internal phonenumber matching API used to isolate the underlying
/// implementation of the matcher and allow different implementations to be /// implementation of the matcher and allow different implementations to be

View File

@@ -41,22 +41,8 @@ pub use phonenumberutil::{
ExtractNumberResult, ExtractNumberResult,
PhoneNumberUtil PhoneNumberUtil
}, },
errors::{ errors::{*},
ExtractNumberError, enums::{*},
GetExampleNumberError,
ParseError,
NotANumberError,
ValidationError,
InternalLogicError,
InvalidNumberError,
InvalidMetadataForValidRegionError
},
enums::{
MatchType,
PhoneNumberType,
NumberLengthType,
PhoneNumberFormat
},
}; };
pub use generated::proto::phonemetadata::{*}; pub use generated::proto::phonemetadata::{*};
pub use generated::proto::phonenumber::PhoneNumber; pub use generated::proto::phonenumber::PhoneNumber;

View File

@@ -20,13 +20,16 @@ use strum::IntoEnumIterator;
use crate::{ use crate::{
interfaces::MatcherApi, generated::metadata::METADATA, interfaces::MatcherApi, generated::metadata::METADATA,
PhoneMetadata, PhoneMetadataCollection, PhoneNumberDesc, generated::proto::{
PhoneNumber, phonemetadata::{
PhoneMetadata, PhoneMetadataCollection, PhoneNumberDesc
},
phonenumber::PhoneNumber,
}
}; };
use super::{ use super::{
PhoneNumberFormat, PhoneNumberType, NumberLengthType, enums::{PhoneNumberFormat, PhoneNumberType, NumberLengthType},
errors::ValidationError, errors::ValidationError,
helper_constants::{ helper_constants::{
OPTIONAL_EXT_SUFFIX, PLUS_SIGN, POSSIBLE_CHARS_AFTER_EXT_LABEL, OPTIONAL_EXT_SUFFIX, PLUS_SIGN, POSSIBLE_CHARS_AFTER_EXT_LABEL,

View File

@@ -23,7 +23,6 @@ pub(self) mod helper_types;
use std::sync::LazyLock; use std::sync::LazyLock;
pub use enums::{MatchType, PhoneNumberFormat, PhoneNumberType, NumberLengthType};
use crate::phonenumberutil::phonenumberutil::PhoneNumberUtil; use crate::phonenumberutil::phonenumberutil::PhoneNumberUtil;
/// Singleton instance of phone number util for general use /// Singleton instance of phone number util for general use

View File

@@ -19,26 +19,32 @@ use std::{
sync::Arc, sync::Arc,
}; };
use super::phone_number_regexps_and_mappings::PhoneNumberRegExpsAndMappings; use super::{
phone_number_regexps_and_mappings::PhoneNumberRegExpsAndMappings,
helper_constants::{
DEFAULT_EXTN_PREFIX, MAX_LENGTH_COUNTRY_CODE, MAX_LENGTH_FOR_NSN, MIN_LENGTH_FOR_NSN,
NANPA_COUNTRY_CODE, PLUS_SIGN, REGION_CODE_FOR_NON_GEO_ENTITY, RFC3966_EXTN_PREFIX,
RFC3966_ISDN_SUBADDRESS, RFC3966_PHONE_CONTEXT, RFC3966_PREFIX,
}, helper_functions::{
self, copy_core_fields_only, get_number_desc_by_type, get_supported_types_for_metadata,
is_national_number_suffix_of_the_other, load_compiled_metadata, normalize_helper,
prefix_number_with_country_calling_code, test_number_length,
test_number_length_with_unknown_type,
},
helper_types::{PhoneNumberWithCountryCodeSource},
enums::{MatchType, PhoneNumberFormat, PhoneNumberType, NumberLengthType},
errors::{
ExtractNumberError, GetExampleNumberError, InternalLogicError,
InvalidMetadataForValidRegionError, InvalidNumberError, ParseError,
ValidationError, NotANumberError
},
};
use crate::{ use crate::{
region_code::RegionCode, interfaces::MatcherApi, macros::owned_from_cow_or, PhoneMetadataCollection, phonenumberutil::{ generated::proto::{
errors::{ phonemetadata::{PhoneMetadataCollection, NumberFormat, PhoneMetadata, PhoneNumberDesc},
ExtractNumberError, GetExampleNumberError, InternalLogicError, phonenumber::{phone_number::CountryCodeSource, PhoneNumber}
InvalidMetadataForValidRegionError, InvalidNumberError, ParseError, },
ValidationError, NotANumberError region_code::RegionCode, interfaces::MatcherApi, macros::owned_from_cow_or,
}, helper_constants::{
DEFAULT_EXTN_PREFIX, MAX_LENGTH_COUNTRY_CODE, MAX_LENGTH_FOR_NSN, MIN_LENGTH_FOR_NSN,
NANPA_COUNTRY_CODE, PLUS_SIGN, REGION_CODE_FOR_NON_GEO_ENTITY, RFC3966_EXTN_PREFIX,
RFC3966_ISDN_SUBADDRESS, RFC3966_PHONE_CONTEXT, RFC3966_PREFIX,
}, helper_functions::{
self, copy_core_fields_only, get_number_desc_by_type, get_supported_types_for_metadata,
is_national_number_suffix_of_the_other, load_compiled_metadata, normalize_helper,
prefix_number_with_country_calling_code, test_number_length,
test_number_length_with_unknown_type,
}, helper_types::{PhoneNumberWithCountryCodeSource}, MatchType, PhoneNumberFormat, PhoneNumberType, NumberLengthType
},
NumberFormat, PhoneMetadata, PhoneNumberDesc,
CountryCodeSource, PhoneNumber,
regex_based_matcher::RegexBasedMatcher, regex_util::{RegexConsume, RegexFullMatch}, regexp_cache::ErrorInvalidRegex, string_util::strip_cow_prefix regex_based_matcher::RegexBasedMatcher, regex_util::{RegexConsume, RegexFullMatch}, regexp_cache::ErrorInvalidRegex, string_util::strip_cow_prefix
}; };

View File

@@ -17,7 +17,7 @@
use log::{error}; use log::{error};
use super::regex_util::{RegexFullMatch, RegexConsume}; use super::regex_util::{RegexFullMatch, RegexConsume};
use crate::{interfaces, PhoneNumberDesc, regexp_cache::{ErrorInvalidRegex, RegexCache}}; use crate::{interfaces, generated::proto::phonemetadata::PhoneNumberDesc, regexp_cache::{ErrorInvalidRegex, RegexCache}};
pub struct RegexBasedMatcher { pub struct RegexBasedMatcher {
cache: RegexCache, cache: RegexCache,