vncstream/server/src/types.rs
modeco80 9b696d3f8b server: Remove VNC support
Also adds references to libretro crates.
2024-10-10 04:30:23 -04:00

43 lines
702 B
Rust

//! Shared types.
#[derive(Clone, Debug)]
pub struct Rect {
pub x: u32,
pub y: u32,
pub width: u32,
pub height: u32,
}
#[derive(Debug)]
pub struct Point {
pub x: u32,
pub y: u32,
}
#[derive(Clone, Debug)]
pub struct Size {
pub width: u32,
pub height: u32,
}
impl Size {
/// Returns the linear size.
pub fn linear(&self) -> usize {
(self.width * self.height) as usize
}
}
impl From<(u32, u32)> for Size {
fn from(value: (u32, u32)) -> Self {
Size {
width: value.0,
height: value.1,
}
}
}
impl Into<(u32, u32)> for Size {
fn into(self) -> (u32, u32) {
(self.width, self.height)
}
}