xloop_event 0.1.0

event types for xloop.
Documentation
use std::borrow::Cow;

#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
pub enum Action {
	Begin,
	Update,
	End,
	Back,
}
#[derive(Debug, Clone)]
pub struct EvtCommit {
	pub action: Action,
	pub data: Option<Cow<'static, str>>,
}
impl EvtCommit {
	pub fn new(action: Action, data: Option<Cow<'static, str>>) -> Self {
		Self { action, data }
	}
	pub fn begin() -> Self {
		Self::new(Action::Begin, None)
	}
	pub fn update(data: Cow<'static, str>) -> Self {
		Self::new(Action::Update, Some(data))
	}
	pub fn end(data: Cow<'static, str>) -> Self {
		Self::new(Action::End, Some(data))
	}
	pub fn back() -> Self {
		Self::new(Action::Back, None)
	}
}