pub struct WaybackMachineClient { /* private fields */ }Expand description
Wayback Machine client for archiving URLs
Implementations§
Source§impl WaybackMachineClient
impl WaybackMachineClient
Sourcepub fn new(client_config: ClientConfig) -> Self
pub fn new(client_config: ClientConfig) -> Self
Constructs a new WaybackMachineClient with the given configuration
Sourcepub async fn archive_url(&self, url: &str) -> Result<ArchiveResult, Error>
pub async fn archive_url(&self, url: &str) -> Result<ArchiveResult, Error>
Checks if a recent Wayback Machine archive exists for the given URL and archives it if necessary.
This function first checks if a recent archive exists for the URL by calling
check_recent_archive_exists. If an archive does not exist or is older than the
configured archive threshold, it proceeds to archive the URL.
It returns an ArchiveResult::Archived if it archives the URL,
or an ArchiveResult::RecentArchiveExists if a recent archive already exists.
§Errors
This method fails if the url provided is not well formatted
of if there was an error while sending the request.
§Example
use waybackmachine_client::{ClientConfig, Error, WaybackMachineClient};
let wayback_client = WaybackMachineClient::new(ClientConfig::default());
wayback_client.archive_url("https://www.openbookpublishers.com/").await?;Auto Trait Implementations§
impl !RefUnwindSafe for WaybackMachineClient
impl !UnwindSafe for WaybackMachineClient
impl Freeze for WaybackMachineClient
impl Send for WaybackMachineClient
impl Sync for WaybackMachineClient
impl Unpin for WaybackMachineClient
impl UnsafeUnpin for WaybackMachineClient
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