style: cargo fmt kernel crates

This commit is contained in:
2026-10-26 19:07:54 +01:00
parent 818eaecadd
commit 1c04ddf909
50 changed files with 995 additions and 499 deletions

View File

@@ -7,4 +7,3 @@ bounded!(PageCount, u16, 1, 1024);
impl Priority {
pub const DEFAULT: Self = Self(16);
}

View File

@@ -2,8 +2,12 @@
pub struct Color(u32);
impl Color {
pub const fn from_raw(v: u32) -> Self { Self(v) }
pub const fn raw(&self) -> u32 { self.0 }
pub const fn from_raw(v: u32) -> Self {
Self(v)
}
pub const fn raw(&self) -> u32 {
self.0
}
pub const fn rgb(r: u8, g: u8, b: u8) -> Self {
Self(((r as u32) << 16) | ((g as u32) << 8) | (b as u32) | 0xFF000000)
@@ -18,19 +22,29 @@ impl Color {
pub struct ScreenCoord(u16);
impl ScreenCoord {
pub const fn new(v: u16) -> Self { Self(v) }
pub const fn raw(&self) -> u16 { self.0 }
pub const fn new(v: u16) -> Self {
Self(v)
}
pub const fn raw(&self) -> u16 {
self.0
}
}
impl core::ops::Add<Dimension> for ScreenCoord {
type Output = Self;
fn add(self, rhs: Dimension) -> Self { Self(self.0 + rhs.0) }
fn add(self, rhs: Dimension) -> Self {
Self(self.0 + rhs.0)
}
}
#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord)]
pub struct Dimension(u16);
impl Dimension {
pub const fn new(v: u16) -> Self { Self(v) }
pub const fn raw(&self) -> u16 { self.0 }
pub const fn new(v: u16) -> Self {
Self(v)
}
pub const fn raw(&self) -> u16 {
self.0
}
}

View File

@@ -33,7 +33,10 @@ macro_rules! bounded {
}
pub const fn const_new(value: $inner) -> Self {
assert!(value >= Self::MIN && value <= Self::MAX, "bounded value out of range");
assert!(
value >= Self::MIN && value <= Self::MAX,
"bounded value out of range"
);
Self(value)
}