pub enum HtmlCleaningProfile {
Default,
Aggressive,
Slim,
Minimal,
Raw,
Auto,
}Expand description
HTML cleaning profile for content processing.
Variants§
Default
Standard cleaning - removes scripts, styles, comments.
Aggressive
Aggressive cleaning - heavy cleanup for extraction.
Slim
Slim cleaning - removes SVGs, canvas, heavy nodes.
Minimal
Minimal cleaning - preserve interactivity.
Raw
No cleaning - raw HTML.
Auto
Auto-select based on content analysis.
Implementations§
Source§impl HtmlCleaningProfile
impl HtmlCleaningProfile
Sourcepub fn from_content_analysis(analysis: &ContentAnalysis) -> HtmlCleaningProfile
pub fn from_content_analysis(analysis: &ContentAnalysis) -> HtmlCleaningProfile
Determine the best cleaning profile based on content analysis.
This is used when Auto is selected to intelligently choose
the appropriate cleaning level based on the HTML content.
Sourcepub fn from_content_analysis_with_intent(
analysis: &ContentAnalysis,
intent: CleaningIntent,
) -> HtmlCleaningProfile
pub fn from_content_analysis_with_intent( analysis: &ContentAnalysis, intent: CleaningIntent, ) -> HtmlCleaningProfile
Determine the best cleaning profile based on content analysis and intended use.
Uses byte sizes (not just counts) for accurate decisions:
- SVG > 100KB → always Slim
- base64 > 100KB → always Slim
- cleanable_ratio > 40% → Slim
Intent modifies behavior:
Extraction→ more aggressive, removes nav/footer/heavy elementsAction→ preserves interactive elements (buttons, forms, links)General→ balanced heuristics
Sourcepub fn removes_svgs(&self) -> bool
pub fn removes_svgs(&self) -> bool
Quick check if this profile removes SVGs.
Sourcepub fn removes_media(&self) -> bool
pub fn removes_media(&self) -> bool
Quick check if this profile removes video/canvas elements.
Sourcepub fn estimate_savings(&self, analysis: &ContentAnalysis) -> usize
pub fn estimate_savings(&self, analysis: &ContentAnalysis) -> usize
Estimate bytes that will be removed by this cleaning profile.
Trait Implementations§
Source§impl Clone for HtmlCleaningProfile
impl Clone for HtmlCleaningProfile
Source§fn clone(&self) -> HtmlCleaningProfile
fn clone(&self) -> HtmlCleaningProfile
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for HtmlCleaningProfile
impl Debug for HtmlCleaningProfile
Source§impl Default for HtmlCleaningProfile
impl Default for HtmlCleaningProfile
Source§fn default() -> HtmlCleaningProfile
fn default() -> HtmlCleaningProfile
Source§impl<'de> Deserialize<'de> for HtmlCleaningProfile
impl<'de> Deserialize<'de> for HtmlCleaningProfile
Source§fn deserialize<__D>(
__deserializer: __D,
) -> Result<HtmlCleaningProfile, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<HtmlCleaningProfile, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
Source§impl PartialEq for HtmlCleaningProfile
impl PartialEq for HtmlCleaningProfile
Source§impl Serialize for HtmlCleaningProfile
impl Serialize for HtmlCleaningProfile
Source§fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
impl Copy for HtmlCleaningProfile
impl Eq for HtmlCleaningProfile
impl StructuralPartialEq for HtmlCleaningProfile
Auto Trait Implementations§
impl Freeze for HtmlCleaningProfile
impl RefUnwindSafe for HtmlCleaningProfile
impl Send for HtmlCleaningProfile
impl Sync for HtmlCleaningProfile
impl Unpin for HtmlCleaningProfile
impl UnsafeUnpin for HtmlCleaningProfile
impl UnwindSafe for HtmlCleaningProfile
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.