diff options
author | Teddy Wing | 2019-11-01 22:05:15 +0100 |
---|---|---|
committer | Teddy Wing | 2019-11-01 22:05:15 +0100 |
commit | 14029dda1f4ad0f58a04c2b190bfebf6c93a9577 (patch) | |
tree | d9df17f952526a178039f3e71dcab0775139eb96 | |
parent | 8a22a24b36a4f0d8c8225c23029b945bcc58619c (diff) | |
download | pdf-urls-14029dda1f4ad0f58a04c2b190bfebf6c93a9577.tar.bz2 |
get_urls_from_pdf: Change argument type to `AsRef<Path>`
-rw-r--r-- | src/lib.rs | 2 | ||||
-rw-r--r-- | src/main.rs | 5 |
2 files changed, 2 insertions, 5 deletions
@@ -4,7 +4,7 @@ use std::path::Path; use lopdf::{Document, Object}; -pub fn get_urls_from_pdf(path: &Path) { +pub fn get_urls_from_pdf<P: AsRef<Path>>(path: P) { let doc = Document::load(path).unwrap(); for (_, obj) in doc.objects { diff --git a/src/main.rs b/src/main.rs index 789e383..14eab24 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1,8 +1,5 @@ -use std::path::Path; - use pdf_urls::get_urls_from_pdf; fn main() { - let path = Path::new("example.pdf"); - get_urls_from_pdf(&path); + get_urls_from_pdf("example.pdf"); } |