# libphonenumber-sys
This is a very early atempt to create rust ffi bindings to googles excellent libphonenumber. Most of the crate has been autogenerated with cpp_to_rust from the current libphonenumber version 7.7 and then modified to work better with rusts native types.
Many functions are not properly implemented yet, especially the ones that take or emit std::strings, as they require additional modifications to the c wrapper.
## Example
```rust
use libphonenumber_sys::{PhoneNumberUtil,PhoneNumber,PhoneNumberFormat,PhoneNumberUtilError};
//get instance of PhoneNumberUtil
let util = PhoneNumberUtil::get_instance();
//construct a number by hand
let number1 = PhoneNumber::new();
number1.set_country_code(1);
number1.set_national_number(2128322000);
//check if number is valid
assert_eq!(util.is_valid_number(&number1), true);
//parse a number from a string
let number2 = util.parse("(800) 1234-5678","US").unwrap();
assert_eq!(number2.country_code(), 1);
assert_eq!(number2.national_number(), 80012345678);
//format a number as E164 string
let e164 = util.format(&number2, PhoneNumberFormat::E164);
assert_eq!(e164, "+180012345678");
```