use std::fmt;
#[derive(Debug, Clone, Copy, PartialEq)]
pub struct Point {
pub x: f64,
pub y: f64,
}
#[derive(Debug, Clone, Copy, PartialEq)]
pub struct Rect {
pub x: f64,
pub y: f64,
pub width: f64,
pub height: f64,
}
#[derive(Debug, Clone, Copy, PartialEq)]
pub struct Metrics {
pub width: f64,
pub height: f64,
pub baseline: f64,
}
#[derive(Debug, Clone, Copy, PartialEq)]
pub struct HostObject {
pub token: u32,
pub rect: Rect,
}
#[derive(Debug, Clone, PartialEq)]
pub struct RenderOutput {
pub caret: Rect,
pub selection: Vec<Rect>,
pub placeholders: Vec<Rect>,
pub metrics: Metrics,
pub menu: Option<Rect>,
pub host_objects: Vec<HostObject>,
}
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub struct StaleSource {
pub source: u64,
pub editor: u64,
}
impl fmt::Display for StaleSource {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
write!(f, "source from revision {} does not match editor revision {}", self.source, self.editor)
}
}
impl std::error::Error for StaleSource {}