pub struct CommodityCode(/* private fields */);Expand description
A validated customs tariff classification: HS-6, CN-8 or TARIC-10.
Implementations§
Source§impl CommodityCode
impl CommodityCode
Sourcepub fn parse(s: &str) -> Result<Self, CommodityCodeError>
pub fn parse(s: &str) -> Result<Self, CommodityCodeError>
Parse a commodity code, accepting the HS, CN and TARIC lengths.
Surrounding whitespace is trimmed; separators are not. A code written
"8507 60 00" is rejected rather than silently compacted, because
stripping characters to make a value parse is how a typo becomes a
different, valid tariff heading.
Sourcepub fn hs_subheading(&self) -> &str
pub fn hs_subheading(&self) -> &str
The HS-6 subheading this code sits under — its own first six digits.
Every CN-8 and TARIC-10 code extends an HS-6 subheading, so this is the globally comparable part of any of the three.
Trait Implementations§
Source§impl Clone for CommodityCode
impl Clone for CommodityCode
Source§impl Debug for CommodityCode
impl Debug for CommodityCode
Source§impl<'de> Deserialize<'de> for CommodityCode
impl<'de> Deserialize<'de> for CommodityCode
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl Display for CommodityCode
impl Display for CommodityCode
impl Eq for CommodityCode
Source§impl Hash for CommodityCode
impl Hash for CommodityCode
Source§impl PartialEq for CommodityCode
impl PartialEq for CommodityCode
Source§impl Serialize for CommodityCode
impl Serialize for CommodityCode
impl StructuralPartialEq for CommodityCode
Auto Trait Implementations§
impl Freeze for CommodityCode
impl RefUnwindSafe for CommodityCode
impl Send for CommodityCode
impl Sync for CommodityCode
impl Unpin for CommodityCode
impl UnsafeUnpin for CommodityCode
impl UnwindSafe for CommodityCode
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.