pub struct StructuredId(pub u32);Expand description
A structured decimal ID encoding category, subcategory, and item number.
Tuple Fields§
§0: u32Implementations§
Source§impl StructuredId
impl StructuredId
Sourcepub fn new(category: u8, subcategory: u8, number: u16) -> Self
pub fn new(category: u8, subcategory: u8, number: u16) -> Self
Create a new structured ID from components.
§Panics
Panics if category is 0 or >99, subcategory >99, or number is 0 or >9999.
Sourcepub fn try_new(category: u8, subcategory: u8, number: u16) -> Option<Self>
pub fn try_new(category: u8, subcategory: u8, number: u16) -> Option<Self>
Try to create a structured ID, returning None if components are out of range.
Sourcepub fn subcategory(&self) -> u8
pub fn subcategory(&self) -> u8
Extract the subcategory (SS) component.
Sourcepub fn to_id_string(&self) -> String
pub fn to_id_string(&self) -> String
Format as zero-padded 8-digit string “CCSSNNNN”.
Trait Implementations§
Source§impl Clone for StructuredId
impl Clone for StructuredId
impl Copy for StructuredId
Source§impl Debug for StructuredId
impl Debug for StructuredId
Source§impl<'de> Deserialize<'de> for StructuredId
impl<'de> Deserialize<'de> for StructuredId
Source§fn deserialize<D: Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error>
fn deserialize<D: Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error>
Deserialize this value from the given Serde deserializer. Read more
Source§impl Display for StructuredId
impl Display for StructuredId
impl Eq for StructuredId
Source§impl Hash for StructuredId
impl Hash for StructuredId
Source§impl PartialEq for StructuredId
impl PartialEq for StructuredId
Source§impl Serialize for StructuredId
impl Serialize for StructuredId
impl StructuralPartialEq for StructuredId
Auto Trait Implementations§
impl Freeze for StructuredId
impl RefUnwindSafe for StructuredId
impl Send for StructuredId
impl Sync for StructuredId
impl Unpin for StructuredId
impl UnsafeUnpin for StructuredId
impl UnwindSafe for StructuredId
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