use crate::linear::proofs::TextOptions;
#[cfg_attr(feature = "latex", doc = "```")]
#[cfg_attr(not(feature = "latex"), doc = "```ignore")]
#[non_exhaustive]
#[derive(Clone, Debug, Default, PartialEq)]
#[cfg_attr(
feature = "serialize",
derive(serde::Serialize, serde::Deserialize),
serde(default, deny_unknown_fields)
)]
pub struct Styles {
pub text: TextOptions,
#[cfg(feature = "latex")]
pub latex: super::latex::Options,
#[cfg(not(feature = "latex"))]
#[cfg_attr(feature = "serialize", serde(skip_serializing))]
latex: Absent,
#[cfg(feature = "typst")]
pub typst: super::typst::Options,
#[cfg(not(feature = "typst"))]
#[cfg_attr(feature = "serialize", serde(skip_serializing))]
typst: Absent,
#[cfg(feature = "svg")]
pub svg: super::svg::Style,
#[cfg(not(feature = "svg"))]
#[cfg_attr(feature = "serialize", serde(skip_serializing))]
svg: Absent,
#[cfg(feature = "png")]
pub png: super::png::Options,
#[cfg(not(feature = "png"))]
#[cfg_attr(feature = "serialize", serde(skip_serializing))]
png: Absent,
#[cfg(feature = "pdf")]
pub pdf: super::pdf::Options,
#[cfg(not(feature = "pdf"))]
#[cfg_attr(feature = "serialize", serde(skip_serializing))]
pdf: Absent,
#[cfg(feature = "rocq")]
pub rocq: super::rocq::Options,
#[cfg(not(feature = "rocq"))]
#[cfg_attr(feature = "serialize", serde(skip_serializing))]
rocq: Absent,
#[cfg(feature = "serialize")]
pub fitch: crate::rules::FitchOptions,
}
impl Styles {
#[must_use]
pub fn with_text(self, text: TextOptions) -> Self {
Self { text, ..self }
}
#[cfg(feature = "latex")]
#[must_use]
pub fn with_latex(self, latex: super::latex::Options) -> Self {
Self { latex, ..self }
}
#[cfg(feature = "typst")]
#[must_use]
pub fn with_typst(self, typst: super::typst::Options) -> Self {
Self { typst, ..self }
}
#[cfg(feature = "svg")]
#[must_use]
pub fn with_svg(self, svg: super::svg::Style) -> Self {
Self { svg, ..self }
}
#[cfg(feature = "png")]
#[must_use]
pub fn with_png(self, png: super::png::Options) -> Self {
Self { png, ..self }
}
#[cfg(feature = "pdf")]
#[must_use]
pub fn with_pdf(self, pdf: super::pdf::Options) -> Self {
Self { pdf, ..self }
}
#[cfg(feature = "rocq")]
#[must_use]
pub fn with_rocq(self, rocq: super::rocq::Options) -> Self {
Self { rocq, ..self }
}
#[cfg(feature = "serialize")]
#[must_use]
pub fn with_fitch(self, fitch: crate::rules::FitchOptions) -> Self {
Self { fitch, ..self }
}
}
#[cfg(not(all(
feature = "latex",
feature = "typst",
feature = "svg",
feature = "png",
feature = "pdf",
feature = "rocq"
)))]
#[derive(Clone, Copy, Debug, Default, PartialEq, Eq)]
struct Absent;
#[cfg(all(
feature = "serialize",
not(all(
feature = "latex",
feature = "typst",
feature = "svg",
feature = "png",
feature = "pdf",
feature = "rocq"
))
))]
impl<'a> serde::Deserialize<'a> for Absent {
fn deserialize<D: serde::Deserializer<'a>>(deserializer: D) -> Result<Self, D::Error> {
serde::de::IgnoredAny::deserialize(deserializer).map(|_| Self)
}
}