pub struct Vin(/* private fields */);Expand description
A validated 17-character VIN.
Construction enforces length, ASCII-alphanumeric chars, and the I/O/Q ban.
Check-digit validation is separate (see crate::Decoder::decode).
Implementations§
Source§impl Vin
impl Vin
Sourcepub fn new(raw: impl Into<String>) -> Result<Self>
pub fn new(raw: impl Into<String>) -> Result<Self>
Parse a raw VIN string. Uppercases ASCII; rejects bad length/chars.
Sourcepub fn check_digit(&self) -> char
pub fn check_digit(&self) -> char
Check digit at position 9.
Sourcepub fn plant_code(&self) -> char
pub fn plant_code(&self) -> char
Plant code at position 11.
Sourcepub fn region_code(&self) -> char
pub fn region_code(&self) -> char
Region code — first character (ISO 3779 region bucket).
Sourcepub fn country_code(&self) -> &str
pub fn country_code(&self) -> &str
Country code — first two characters (ISO 3779 country range).
Sourcepub fn squish_vin(&self) -> String
pub fn squish_vin(&self) -> String
Squish-VIN — the 10-char fingerprint used by some lookup tools: chars 1-8 + chars 10-11 (skipping the check digit at position 9).
Sourcepub fn year_candidates(&self) -> Vec<u32>
pub fn year_candidates(&self) -> Vec<u32>
Both possible model-year candidates from the VIN’s pos-10 year code.
SAE-J853 reuses each letter twice (30-year cycle), so a code like
'F' maps to both 1985 and 2015. This returns both. Numeric codes
1-9 only ever map to a single year (2001-2009) since the second
digit cycle (2031-2039) hasn’t started. Returns an empty vec for
unreadable codes (I/O/Q/U/Z/0).
Note: many manufacturers don’t follow the SAE-J853 pos-10 convention (modern Mercedes encodes year in the chassis serial; some Renault / Dacia families use other positions; Ford EU uses pos-11). For those VINs this method may return candidates that don’t include the actual model year. The decoder no longer auto-picks one — consumers can inspect the candidates and make their own call.
Trait Implementations§
impl Eq for Vin
impl StructuralPartialEq for Vin
Auto Trait Implementations§
impl Freeze for Vin
impl RefUnwindSafe for Vin
impl Send for Vin
impl Sync for Vin
impl Unpin for Vin
impl UnsafeUnpin for Vin
impl UnwindSafe for Vin
Blanket Implementations§
Source§impl<T> ArchivePointee for T
impl<T> ArchivePointee for T
Source§type ArchivedMetadata = ()
type ArchivedMetadata = ()
Source§fn pointer_metadata(
_: &<T as ArchivePointee>::ArchivedMetadata,
) -> <T as Pointee>::Metadata
fn pointer_metadata( _: &<T as ArchivePointee>::ArchivedMetadata, ) -> <T as Pointee>::Metadata
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> LayoutRaw for T
impl<T> LayoutRaw for T
Source§fn layout_raw(_: <T as Pointee>::Metadata) -> Result<Layout, LayoutError>
fn layout_raw(_: <T as Pointee>::Metadata) -> Result<Layout, LayoutError>
Source§impl<T, N1, N2> Niching<NichedOption<T, N1>> for N2
impl<T, N1, N2> Niching<NichedOption<T, N1>> for N2
Source§unsafe fn is_niched(niched: *const NichedOption<T, N1>) -> bool
unsafe fn is_niched(niched: *const NichedOption<T, N1>) -> bool
Source§fn resolve_niched(out: Place<NichedOption<T, N1>>)
fn resolve_niched(out: Place<NichedOption<T, N1>>)
out indicating that a T is niched.