oh right this was supposed to be http

This commit is contained in:
Qyriad 2026-03-30 13:39:56 +02:00
parent 1ca5aa2e97
commit adaa020029
14 changed files with 1187 additions and 1040 deletions

View file

@ -37,8 +37,33 @@ impl Line {
self.0
}
#[cfg(target_pointer_width = "64")]
pub const fn index_usize(self) -> usize {
self.0 as usize
}
/// 1-indexed
pub const fn linenr(self) -> u64 {
self.0 + 1
}
}
/// [Alternate](Formatter::alternate) flag capitalizes "line".
///
/// ```
/// # use dynix::Line;
/// let line = Line::from_index(22);
/// assert_eq!(format!("{line}"), "line 23");
/// assert_eq!(format!("{line:#}"), "Line 23");
/// ```
impl Display for Line {
fn fmt(&self, f: &mut Formatter) -> FmtResult {
if f.alternate() {
write!(f, "Line {}", self.linenr())?;
} else {
write!(f, "line {}", self.linenr())?;
}
Ok(())
}
}