#[cfg_attr(target_os = "freebsd", path = "fetch_impl_freebsdfetch.rs")]
#[cfg_attr(target_os = "macos", path = "fetch_impl_curl.rs")]
#[cfg_attr(target_os = "linux", path = "fetch_impl_curl.rs")]
mod fetch_impl_real;
use crate::error::Result;
pub use fetch_impl_real::FetchImpl;
pub trait Fetch where Self: Sized {
fn new() -> Result<Self>;
fn get<T>(&self, url: T) -> Result<Vec<u8>> where T: AsRef<str>;
}
#[cfg(test)]
mod tests {
use crate::fetch::{ Fetch, fetch_impl::FetchImpl };
#[test]
fn test_fetch_get() {
let data = FetchImpl::new().expect("Failed to initialize fetch instance")
.get("https://example.com").expect("Failed to get resource");
assert!(!data.is_empty());
}
}