Skip to content

Commit

Permalink
Doc fixes.
Browse files Browse the repository at this point in the history
  • Loading branch information
virtualritz committed Apr 22, 2024
1 parent 226d84d commit 2b5dd36
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 24 deletions.
46 changes: 27 additions & 19 deletions src/metadata/metadata.rs
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ impl Metadata {
/// of "country calling codes" used for non-geographical entities, such as
/// Universal International Toll Free Number (+800). These are all given the
/// ID "001", since this is the numeric region code for the world according
/// to UN M.49: http://en.wikipedia.org/wiki/UN_M.49
/// to [UN M.49](http://en.wikipedia.org/wiki/UN_M.49).
pub fn id(&self) -> &str {
&self.id
}
Expand Down Expand Up @@ -128,7 +128,7 @@ impl Metadata {
/// Fortaleza, Brazil (area code 85) using the long distance carrier Oi
/// (selection code 31), one would dial 0 31 85 2222 2222. Assuming the only
/// other possible carrier selection code is 32, the field will contain
/// "03[12]".
/// `"03\[12\]"`.
///
/// When it is missing from the XML file, this field inherits the value of
/// national prefix, if that is present.
Expand All @@ -141,8 +141,9 @@ impl Metadata {
/// different ways when dialed in-country and out-of-country (e.g. 0343 15
/// 555 1212 is exactly the same number as +54 9 343 555 1212).
///
/// This field is used together with `national_prefix_for_parsing` to transform
/// the number into a particular representation for storing in the
/// This field is used together with
/// [`national_prefix_for_parsing()`](Self::national_prefix_for_parsing) to
/// transform the number into a particular representation for storing in the
/// phonenumber proto buffer in those rare cases.
pub fn national_prefix_transform_rule(&self) -> Option<&str> {
self.national_prefix_transform_rule
Expand All @@ -169,23 +170,30 @@ impl Metadata {
/// the prefix 0 and the carrier selection code
/// 15 (inserted after the area code of 343) is used.
///
/// Note: this field is populated by setting a value for <intlFormat> inside
/// the <numberFormat> tag in the XML file. If <intlFormat> is not set then
/// it defaults to the same value as the <format> tag.
/// Note: this field is populated by setting a value for `<intlFormat>`
/// inside the `<numberFormat>` tag in the XML file. If `<intlFormat>` is
/// not set then it defaults to the same value as the `<format>` tag.
///
/// Examples:
/// To set the <intlFormat> to a different value than the <format>:
/// <numberFormat pattern=....>
/// <format>$1 $2 $3</format>
/// <intlFormat>$1-$2-$3</intlFormat>
/// </numberFormat>
/// ## Examples
///
/// To have a format only used for national formatting, set <intlFormat> to
/// "NA":
/// <numberFormat pattern=....>
/// <format>$1 $2 $3</format>
/// <intlFormat>NA</intlFormat>
/// </numberFormat>
/// To set the `<intlFormat>` to a different value than the `<format>`:
///
/// ```xml
/// <numberFormat pattern=....>
/// <format>$1 $2 $3</format>
/// <intlFormat>$1-$2-$3</intlFormat>
/// </numberFormat>
/// ```
///
/// To have a format only used for national formatting, set `<intlFormat>` to
/// `"NA"`:
///
/// ```xml
/// <numberFormat pattern=....>
/// <format>$1 $2 $3</format>
/// <intlFormat>NA</intlFormat>
/// </numberFormat>
/// ```
pub fn international_formats(&self) -> &[Format] {
&self.international_formats
}
Expand Down
3 changes: 2 additions & 1 deletion src/national_number.rs
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,8 @@ impl NationalNumber {
/// of an Italian phone number indicates the number is a fixed-line number.
/// There have been plans to migrate fixed-line numbers to start with the
/// digit two since December 2000, but it has not happened yet. See
/// http://en.wikipedia.org/wiki/%2B39 for more details.
/// [Telephone numbers in Italy](http://en.wikipedia.org/wiki/%2B39) for more
/// details.
///
/// These fields can be safely ignored (there is no need to set them) for
/// most countries. Some limited number of countries behave like Italy - for
Expand Down
11 changes: 7 additions & 4 deletions src/phone_number.rs
Original file line number Diff line number Diff line change
Expand Up @@ -96,13 +96,16 @@ pub enum Type {
PremiumRate,

/// The cost of this call is shared between the caller and the recipient, and
/// is hence typically less than PREMIUM_RATE calls. See
/// http://en.wikipedia.org/wiki/Shared_Cost_Service for more information.
/// is hence typically less than [`PremiumRate`](Self::PremiumRate) calls. See
/// [Shared-cost Service](http://en.wikipedia.org/wiki/Shared-cost_service)
/// for more information.
SharedCost,

/// A personal number is associated with a particular person, and may be
/// routed to either a MOBILE or FIXED_LINE number. Some more information can
/// be found here: http://en.wikipedia.org/wiki/Personal_Numbers
/// routed to either a [`Mobile`](Self::Mobile) or
/// [`FixedLine`](Self::FixedLine) number. See
/// [Personal Numbers](http://en.wikipedia.org/wiki/Personal_Numbers) for more
/// information.
PersonalNumber,

/// Voice over IP numbers. This includes TSoIP (Telephony Service over IP).
Expand Down

0 comments on commit 2b5dd36

Please sign in to comment.