rcus-core 0.1.3

Core types for rcus: retained view tree, style, input, and the host bridge protocol
Documentation
use std::fmt;

#[derive(Clone, Debug, PartialEq, Eq, Hash)]
pub struct Action {
    name: String,
}

impl Action {
    pub fn new(name: impl Into<String>) -> Self {
        Self { name: name.into() }
    }

    pub fn name(&self) -> &str {
        &self.name
    }
}

#[derive(Debug, Clone, PartialEq, Eq)]
pub enum ActionError {
    Unknown(String),
}

impl fmt::Display for ActionError {
    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
        match self {
            Self::Unknown(name) => write!(f, "unknown action: {name}"),
        }
    }
}

impl std::error::Error for ActionError {}