pub struct ItemId(/* private fields */);Expand description
A validated work-item identifier (e.g. bn-a7x, bn-a7x.1).
The inner string is guaranteed to be a valid terseid ID with the bn prefix.
Construction goes through FromStr, ItemId::new_unchecked, or the
generator helpers.
Implementations§
Source§impl ItemId
impl ItemId
Sourcepub fn new_unchecked(raw: impl Into<String>) -> Self
pub fn new_unchecked(raw: impl Into<String>) -> Self
Sourcepub fn parse(raw: &str) -> Result<Self, ItemIdError>
pub fn parse(raw: &str) -> Result<Self, ItemIdError>
Parse and validate a raw string into an ItemId.
The string is lower-cased and trimmed before validation.
§Errors
Returns ItemIdError::InvalidFormat if the format is wrong, or
ItemIdError::WrongPrefix if the prefix is not bn.
Sourcepub fn parse_any_prefix(raw: &str) -> Result<Self, ItemIdError>
pub fn parse_any_prefix(raw: &str) -> Result<Self, ItemIdError>
Parse any valid terseid ID regardless of prefix.
Used by the event parser and migration paths where IDs from external systems (e.g. beads with custom prefixes) must be accepted.
§Errors
Returns ItemIdError::InvalidFormat if the string is not a valid
terseid ID.
Sourcepub fn child(&self, number: u32) -> Self
pub fn child(&self, number: u32) -> Self
Create a child ID by appending a child number.
let parent = ItemId::parse("bn-a7x").unwrap();
let child = parent.child(1);
assert_eq!(child.as_str(), "bn-a7x.1");Sourcepub fn is_child_of(&self, ancestor: &Self) -> bool
pub fn is_child_of(&self, ancestor: &Self) -> bool
Return true if self is a descendant of ancestor.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for ItemId
impl<'de> Deserialize<'de> for ItemId
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>,
Source§impl Ord for ItemId
impl Ord for ItemId
Source§impl PartialOrd for ItemId
impl PartialOrd for ItemId
impl Eq for ItemId
impl StructuralPartialEq for ItemId
Auto Trait Implementations§
impl Freeze for ItemId
impl RefUnwindSafe for ItemId
impl Send for ItemId
impl Sync for ItemId
impl Unpin for ItemId
impl UnsafeUnpin for ItemId
impl UnwindSafe for ItemId
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Comparable<K> for Q
impl<Q, K> Comparable<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
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
key and return true if they are equal.