An International Standard Book Number, either ISBN10 or ISBN13.
use isbn::{Isbn, Isbn10, Isbn13};
let isbn_10 = Isbn::_10(Isbn10::new(8, 9, 6, 6, 2, 6, 1, 2, 6, 4).unwrap());
let isbn_13 = Isbn::_13(Isbn13::new(9, 7, 8, 1, 4, 9, 2, 0, 6, 7, 6, 6, 5).unwrap());
assert_eq!("89-6626-126-4".parse(), Ok(isbn_10));
assert_eq!("978-1-4920-6766-5".parse(), Ok(isbn_13));
Hyphenate an ISBN into its parts:
- GS1 Prefix (ISBN-13 only)
- Registration group
- Registrant
- Publication
- Check digit
use isbn::{Isbn, Isbn10, Isbn13};
let isbn_10 = Isbn::_10(Isbn10::new(8, 9, 6, 6, 2, 6, 1, 2, 6, 4).unwrap());
let isbn_13 = Isbn::_13(Isbn13::new(9, 7, 8, 1, 4, 9, 2, 0, 6, 7, 6, 6, 5).unwrap());
assert_eq!(isbn_10.hyphenate().unwrap().as_str(), "89-6626-126-4");
assert_eq!(isbn_13.hyphenate().unwrap().as_str(), "978-1-4920-6766-5");
Retrieve the name of the registration group.
use isbn::{Isbn, Isbn10, Isbn13};
let isbn_10 = Isbn::_10(Isbn10::new(8, 9, 6, 6, 2, 6, 1, 2, 6, 4).unwrap());
let isbn_13 = Isbn::_13(Isbn13::new(9, 7, 8, 1, 4, 9, 2, 0, 6, 7, 6, 6, 5).unwrap());
assert_eq!(isbn_10.registration_group(), Ok("Korea, Republic"));
assert_eq!(isbn_13.registration_group(), Ok("English language"));
Formats the value using the given formatter. Read more
Formats the value using the given formatter. Read more
This method tests for self
and other
values to be equal, and is used by ==
. Read more
This method tests for !=
.
The associated error which can be returned from parsing.
Parses a string s
to return a value of this type. Read more
🔬 This is a nightly-only experimental API. (try_from
)
The type returned in the event of a conversion error.
🔬 This is a nightly-only experimental API. (try_from
)
🔬 This is a nightly-only experimental API. (try_from
)
The type returned in the event of a conversion error.
🔬 This is a nightly-only experimental API. (try_from
)
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more
🔬 This is a nightly-only experimental API. (get_type_id
)
this method will likely be replaced by an associated static