Struct phonenumber::metadata::Database
[−]
[src]
pub struct Database { /* fields omitted */ }
Representation of a database of metadata for phone number.
Methods
impl Database
[src]
pub fn load<P: AsRef<Path>>(path: P) -> Result<Self, Error>
[src]
Load a database from the given file.
pub fn parse<S: AsRef<str>>(content: S) -> Result<Self, Error>
[src]
Parse a database from the given string.
pub fn from(meta: Vec<Metadata>) -> Result<Self, Error>
[src]
Create a database from a loaded database.
pub fn cache(&self) -> Arc<Mutex<RegexCache>>
[src]
Get the regular expression cache.
pub fn by_id<Q: ?Sized>(&self, key: &Q) -> Option<&Metadata> where
Q: Hash + Eq,
String: Borrow<Q>,
[src]
Q: Hash + Eq,
String: Borrow<Q>,
Get a metadata entry by country ID.
pub fn by_code<Q: ?Sized>(&self, key: &Q) -> Option<Vec<&Metadata>> where
Q: Hash + Eq,
u16: Borrow<Q>,
[src]
Q: Hash + Eq,
u16: Borrow<Q>,
Get metadata entries by country code.
pub fn region<Q: ?Sized>(&self, code: &Q) -> Option<Vec<&str>> where
Q: Hash + Eq,
u16: Borrow<Q>,
[src]
Q: Hash + Eq,
u16: Borrow<Q>,
Get all country IDs corresponding to the given country code.
Trait Implementations
impl Clone for Database
[src]
fn clone(&self) -> Database
[src]
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0[src]
Performs copy-assignment from source
. Read more