pub struct DocumentFetcher { /* private fields */ }Expand description
Fetches RFC and draft document content (HTML or plain text).
Talks primarily to rfc-editor.org and ietf.org/archive, with a side
trip to datatracker.ietf.org to resolve -NN version suffixes for
drafts the user supplied unversioned.
Implementations§
Source§impl DocumentFetcher
impl DocumentFetcher
Sourcepub fn with_client(client: Client) -> Self
pub fn with_client(client: Client) -> Self
Build a fetcher that reuses an existing HTTP client. Lets a single
client back both this and DataTrackerClient so we don’t pay for
two connection pools per command invocation.
Sourcepub async fn fetch(&self, doc: &DocumentType) -> Result<(String, Format)>
pub async fn fetch(&self, doc: &DocumentType) -> Result<(String, Format)>
Fetch a document, preferring plain text and falling back to HTML.
Drafts without a version suffix are resolved to their latest revision via datatracker before fetching.
Sourcepub fn html_url(&self, doc: &DocumentType) -> String
pub fn html_url(&self, doc: &DocumentType) -> String
HTML URL for a document.
Sourcepub fn text_url(&self, doc: &DocumentType) -> String
pub fn text_url(&self, doc: &DocumentType) -> String
Plain-text URL for a document.
Auto Trait Implementations§
impl !RefUnwindSafe for DocumentFetcher
impl !UnwindSafe for DocumentFetcher
impl Freeze for DocumentFetcher
impl Send for DocumentFetcher
impl Sync for DocumentFetcher
impl Unpin for DocumentFetcher
impl UnsafeUnpin for DocumentFetcher
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