pub struct WebFetchPresentation { /* private fields */ }Expand description
Bounded provider-neutral presentation of one client web-fetch result.
This contains only normalized URLs, extracted text, and explicit metadata. It deliberately has no provider-owned continuation or raw-response field.
Implementations§
Source§impl WebFetchPresentation
impl WebFetchPresentation
Sourcepub fn new(
requested_url: impl Into<String>,
final_url: impl Into<String>,
mime_type: impl Into<String>,
body: impl Into<String>,
) -> Result<Self, ExternalContentError>
pub fn new( requested_url: impl Into<String>, final_url: impl Into<String>, mime_type: impl Into<String>, body: impl Into<String>, ) -> Result<Self, ExternalContentError>
Creates a normalized presentation with bounded metadata and extracted body.
§Errors
Returns an error when a URL, MIME type, or body violates durable bounds.
Sourcepub fn with_title(
self,
title: impl Into<String>,
) -> Result<Self, ExternalContentError>
pub fn with_title( self, title: impl Into<String>, ) -> Result<Self, ExternalContentError>
Adds an optional bounded document title.
§Errors
Returns an error for an empty, oversized, or control-containing title.
Sourcepub const fn with_truncation(self, truncation: WebFetchTruncation) -> Self
pub const fn with_truncation(self, truncation: WebFetchTruncation) -> Self
Records why the extracted body was truncated.
Sourcepub fn with_redirects(
self,
redirects: Vec<WebFetchRedirect>,
) -> Result<Self, ExternalContentError>
pub fn with_redirects( self, redirects: Vec<WebFetchRedirect>, ) -> Result<Self, ExternalContentError>
Adds bounded normalized redirect metadata.
§Errors
Returns an error when more than ten redirects are supplied or one is invalid.
Sourcepub fn requested_url(&self) -> &str
pub fn requested_url(&self) -> &str
Returns the normalized requested URL.
Sourcepub const fn truncation(&self) -> Option<WebFetchTruncation>
pub const fn truncation(&self) -> Option<WebFetchTruncation>
Returns the explicit truncation reason when present.
Sourcepub fn redirects(&self) -> &[WebFetchRedirect]
pub fn redirects(&self) -> &[WebFetchRedirect]
Returns normalized redirects in request order.
Trait Implementations§
Source§impl Clone for WebFetchPresentation
impl Clone for WebFetchPresentation
Source§fn clone(&self) -> WebFetchPresentation
fn clone(&self) -> WebFetchPresentation
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more