use std::{collections::HashSet, time::SystemTime};
use ustr::{Ustr, UstrSet};
#[derive(Debug, Clone, Default)]
pub struct DeathLinkOptions {
pub(crate) games: Option<UstrSet>,
pub(crate) slots: Option<HashSet<u32>>,
pub(crate) tags: Option<UstrSet>,
pub(crate) time: Option<SystemTime>,
pub(crate) source: Option<String>,
pub(crate) cause: Option<String>,
}
impl DeathLinkOptions {
pub fn new() -> Self {
Default::default()
}
pub fn games(mut self, games: impl IntoIterator<Item = impl Into<Ustr>>) -> Self {
self.games = Some(games.into_iter().map(|u| u.into()).collect());
self
}
pub fn slots(mut self, slots: impl IntoIterator<Item = u32>) -> Self {
self.slots = Some(slots.into_iter().collect());
self
}
pub fn tags(mut self, tags: impl IntoIterator<Item = impl Into<Ustr>>) -> Self {
self.tags = Some(tags.into_iter().map(|u| u.into()).collect());
self
}
pub fn time(mut self, time: SystemTime) -> Self {
self.time = Some(time);
self
}
pub fn source(mut self, source: String) -> Self {
self.cause = Some(source);
self
}
pub fn cause(mut self, cause: String) -> Self {
self.cause = Some(cause);
self
}
}