Completed docs, added icon

This commit is contained in:
2023-05-28 17:24:56 +01:00
parent 6b71164aca
commit 6f5a9d05dd
28 changed files with 295 additions and 5 deletions

View File

@@ -23,6 +23,7 @@ pub trait InternedDisplay {
self.bundle(i).to_string()
}
/// Combine with an interner to implement [Display]
fn bundle<'a>(&'a self, interner: &'a Interner) -> DisplayBundle<'a, Self> {
DisplayBundle { interner, data: self }
}

View File

@@ -13,12 +13,15 @@ pub struct Tok<T> {
phantom_data: PhantomData<T>,
}
impl<T> Tok<T> {
/// Wrap an ID number into a token
pub fn from_id(id: NonZeroU32) -> Self {
Self { id, phantom_data: PhantomData }
}
/// Take the ID number out of a token
pub fn into_id(self) -> NonZeroU32 {
self.id
}
/// Cast into usize
pub fn into_usize(self) -> usize {
let zero: u32 = self.id.into();
zero as usize