Skip to content

Commit bdd8da7

Browse files
authored
Merge pull request #19 from emilsivervik/chore/update-docs
chore: update docs
2 parents e28801e + 5f6b7b8 commit bdd8da7

File tree

1 file changed

+13
-13
lines changed

1 file changed

+13
-13
lines changed

src/lib.rs

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ impl fmt::Display for PersonnummerError {
4343
impl Error for PersonnummerError {}
4444

4545
#[allow(dead_code)]
46-
/// Personnummer holds relevant data to check for valid personal identity numbers.
46+
/// [Personnummer] holds relevant data to check for valid personal identity numbers.
4747
pub struct Personnummer {
4848
date: chrono::NaiveDate,
4949
serial: u32,
@@ -52,7 +52,7 @@ pub struct Personnummer {
5252
coordination: bool,
5353
}
5454

55-
/// FormattedPersonnummer holds two formats of a normalized personal identity number, one long and
55+
/// [FormattedPersonnummer] holds two formats of a normalized personal identity number, one long and
5656
/// one short format. The long format displays the full century while the short format only
5757
/// displays the year.
5858
pub struct FormattedPersonnummer {
@@ -61,12 +61,12 @@ pub struct FormattedPersonnummer {
6161
}
6262

6363
impl FormattedPersonnummer {
64-
/// Returns the long format of a formatted personal identity number as a String.
64+
/// Returns the long format of a formatted personal identity number as a [String].
6565
pub fn long(&self) -> String {
6666
self.long.clone()
6767
}
6868

69-
/// Returns the short format of a formatted personal identity number as a String.
69+
/// Returns the short format of a formatted personal identity number as a [String].
7070
pub fn short(&self) -> String {
7171
self.short.clone()
7272
}
@@ -127,19 +127,19 @@ impl TryFrom<&str> for Personnummer {
127127
}
128128

129129
impl Personnummer {
130-
/// Returns a new instance of a Personnummer. Panics for invalid dates but not for invalid
131-
/// personal identity numbers. Use valid() to check validity.
130+
/// Returns a new instance of a [Personnummer]. Panics for invalid dates but not for invalid
131+
/// personal identity numbers. Use [Personnummer::valid()] to check validity.
132132
pub fn new(pnr: &str) -> Result<Personnummer, PersonnummerError> {
133133
Personnummer::try_from(pnr)
134134
}
135135

136-
/// Same as new() but returns an Option instead of panicing on invalid dates.
136+
/// Same as [Personnummer::new()] but returns an [Option] instead of panicing on invalid dates.
137137
pub fn parse(pnr: &str) -> Result<Personnummer, PersonnummerError> {
138138
Personnummer::try_from(pnr)
139139
}
140140

141-
/// Returns a FormattedPersonnummer from a Personnummer which can be used to display a
142-
/// normalized version of the Personnummer.
141+
/// Returns a [FormattedPersonnummer] from a [Personnummer] which can be used to display a
142+
/// normalized version of the [Personnummer].
143143
pub fn format(&self) -> FormattedPersonnummer {
144144
let day = self.date.day();
145145
let day_or_coordination = if self.coordination {
@@ -162,7 +162,7 @@ impl Personnummer {
162162
FormattedPersonnummer { long, short }
163163
}
164164

165-
/// Validate a Personnummer. The validation requires a valid date and that the Luhn checksum
165+
/// Validate a [Personnummer]. The validation requires a valid date and that the Luhn checksum
166166
/// matches the control digit.
167167
pub fn valid(&self) -> bool {
168168
let ymd = format!(
@@ -206,17 +206,17 @@ impl Personnummer {
206206
self.coordination
207207
}
208208

209-
/// Year of date of birth.
209+
/// Year of birth date.
210210
pub fn year(&self) -> i32 {
211211
self.date.year()
212212
}
213213

214-
/// Month of date of birth.
214+
/// Month of birth date.
215215
pub fn month(&self) -> u32 {
216216
self.date.month()
217217
}
218218

219-
/// Day of date of birth.
219+
/// Day of birth date.
220220
pub fn day(&self) -> u32 {
221221
self.date.day()
222222
}

0 commit comments

Comments
 (0)