use super::RedactionReason;
use super::RedactionReasons;
use super::RedactionUsage;
use crate::output::RedactionCompletion;
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub struct RedactionSummary {
redaction_disabled: bool,
completion: RedactionCompletion,
reasons: RedactionReasons,
usage: RedactionUsage,
}
impl RedactionSummary {
#[must_use]
#[inline(always)]
pub(crate) const fn from_parts(
redaction_disabled: bool,
completion: RedactionCompletion,
reasons: RedactionReasons,
usage: RedactionUsage,
) -> Self {
Self {
redaction_disabled,
completion,
reasons,
usage,
}
}
#[must_use]
#[inline(always)]
pub(crate) const fn truncated(reason: RedactionReason) -> Self {
Self {
redaction_disabled: false,
completion: RedactionCompletion::Truncated,
reasons: RedactionReasons::empty().with(reason),
usage: RedactionUsage::empty(),
}
}
#[must_use]
#[inline(always)]
pub(crate) const fn exhausted() -> Self {
Self {
redaction_disabled: false,
completion: RedactionCompletion::Exhausted,
reasons: RedactionReasons::empty().with(RedactionReason::OutputLimitReached),
usage: RedactionUsage::empty(),
}
}
#[must_use = "the completion state describes whether the output is complete"]
#[inline(always)]
pub const fn completion(self) -> RedactionCompletion {
self.completion
}
#[must_use]
#[inline(always)]
pub const fn is_redaction_disabled(self) -> bool {
self.redaction_disabled
}
#[must_use]
#[inline(always)]
pub const fn reasons(self) -> RedactionReasons {
self.reasons
}
#[must_use]
#[inline(always)]
pub const fn usage(self) -> RedactionUsage {
self.usage
}
}