#[derive(Debug, Clone, PartialEq, Eq)]
pub struct HostText {
pub kind: &'static str,
pub text: String,
}
#[derive(Debug, Clone, PartialEq, Eq)]
#[non_exhaustive]
pub enum ClipboardPayload {
None,
Tsv(String),
}
impl ClipboardPayload {
#[must_use]
pub const fn is_none(&self) -> bool {
matches!(self, Self::None)
}
}
#[derive(Debug, Clone, PartialEq, Eq)]
#[non_exhaustive]
pub struct HostProjection {
pub text_nodes: Vec<HostText>,
pub clipboard: Option<ClipboardPayload>,
}
impl HostProjection {
pub(crate) fn sealed() -> Self {
Self {
text_nodes: Vec::new(),
clipboard: None,
}
}
#[must_use]
pub fn audit_text(&self) -> String {
let mut s = String::new();
for t in &self.text_nodes {
s.push_str(&t.text);
s.push('\n');
}
if let Some(ClipboardPayload::Tsv(tsv)) = &self.clipboard {
s.push_str(tsv);
}
s
}
}