pub struct HtmlDiffResult {
pub is_initial: bool,
pub url_changed: bool,
pub title_changed: bool,
pub changed: Vec<ElementChange>,
pub added: Vec<String>,
pub removed: Vec<String>,
pub unchanged_count: usize,
pub condensed_html: Option<String>,
pub full_html: Option<String>,
pub savings_ratio: f64,
}Expand description
Result of computing an HTML diff.
Fields§
§is_initial: boolWhether this is the initial state (no previous).
url_changed: boolWhether URL changed.
title_changed: boolWhether title changed.
changed: Vec<ElementChange>Elements that changed.
added: Vec<String>New elements that appeared.
removed: Vec<String>Paths of elements that were removed.
unchanged_count: usizeCount of unchanged elements.
condensed_html: Option<String>Condensed HTML context for LLM.
full_html: Option<String>Full HTML (for reference/debugging).
savings_ratio: f64Token savings ratio (0.0 to 1.0).
Implementations§
Source§impl HtmlDiffResult
impl HtmlDiffResult
Sourcepub fn initial(html: &str, _url: &str, _title: &str) -> HtmlDiffResult
pub fn initial(html: &str, _url: &str, _title: &str) -> HtmlDiffResult
Create an initial (first round) result.
Sourcepub fn has_changes(&self) -> bool
pub fn has_changes(&self) -> bool
Check if there are any significant changes.
Sourcepub fn html_for_llm(&self, min_savings: f64) -> &str
pub fn html_for_llm(&self, min_savings: f64) -> &str
Get the HTML to send to the LLM.
Returns condensed HTML if available and there are savings, otherwise returns full HTML.
Sourcepub fn estimated_token_savings(&self, original_tokens: usize) -> usize
pub fn estimated_token_savings(&self, original_tokens: usize) -> usize
Estimate token savings.
Trait Implementations§
Source§impl Clone for HtmlDiffResult
impl Clone for HtmlDiffResult
Source§fn clone(&self) -> HtmlDiffResult
fn clone(&self) -> HtmlDiffResult
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for HtmlDiffResult
impl Debug for HtmlDiffResult
Source§impl<'de> Deserialize<'de> for HtmlDiffResult
impl<'de> Deserialize<'de> for HtmlDiffResult
Source§fn deserialize<__D>(
__deserializer: __D,
) -> Result<HtmlDiffResult, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<HtmlDiffResult, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl Serialize for HtmlDiffResult
impl Serialize for HtmlDiffResult
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,
Serialize this value into the given Serde serializer. Read more
Auto Trait Implementations§
impl Freeze for HtmlDiffResult
impl RefUnwindSafe for HtmlDiffResult
impl Send for HtmlDiffResult
impl Sync for HtmlDiffResult
impl Unpin for HtmlDiffResult
impl UnwindSafe for HtmlDiffResult
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
Mutably borrows from an owned value. Read more