pub enum Isbn {
Isbn10(String),
Isbn13(String),
}Expand description
A validated ISBN (either ISBN-10 or ISBN-13).
Variants§
Implementations§
Source§impl Isbn
impl Isbn
Sourcepub fn parse(input: &str) -> Result<Self, TokuError>
pub fn parse(input: &str) -> Result<Self, TokuError>
Parse and validate an ISBN string (10 or 13 digits).
Sourcepub fn to_isbn13(&self) -> String
pub fn to_isbn13(&self) -> String
Convert this ISBN to ISBN-13. ISBN-13 returns itself. Only 978-prefixed ISBN-10s can be converted.
Sourcepub fn to_isbn10(&self) -> Option<String>
pub fn to_isbn10(&self) -> Option<String>
Convert this ISBN to ISBN-10 if possible. Only 978-prefixed ISBN-13s convert.
pub fn as_str(&self) -> &str
Trait Implementations§
impl Eq for Isbn
impl StructuralPartialEq for Isbn
Auto Trait Implementations§
impl Freeze for Isbn
impl RefUnwindSafe for Isbn
impl Send for Isbn
impl Sync for Isbn
impl Unpin for Isbn
impl UnsafeUnpin for Isbn
impl UnwindSafe for Isbn
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more