use super::super::bom::BomType;
use alloc::string::String;
#[derive(Debug, Clone, PartialEq)]
pub struct EncodingInfo {
pub encoding: String,
pub confidence: f32,
pub has_bom: bool,
pub bom_type: Option<BomType>,
pub is_valid: bool,
}
impl EncodingInfo {
#[must_use]
pub const fn new(encoding: String, confidence: f32) -> Self {
Self {
encoding,
confidence,
has_bom: false,
bom_type: None,
is_valid: true,
}
}
#[must_use]
pub const fn with_bom(encoding: String, confidence: f32, bom_type: BomType) -> Self {
Self {
encoding,
confidence,
has_bom: true,
bom_type: Some(bom_type),
is_valid: true,
}
}
}