refactor(read): follow convention for imports

This commit is contained in:
Kat Marchán 2019-05-24 17:13:50 -07:00
parent bff95f20ec
commit 837e90b484
No known key found for this signature in database
GPG Key ID: AEB529C08A3C7E9E
1 changed files with 6 additions and 6 deletions

View File

@ -1,27 +1,27 @@
use crate::content::path::content_path; use crate::content::path;
use ssri::Integrity; use ssri::Integrity;
use std::path::Path; use std::path::Path;
use std::fs::{self, File}; use std::fs::{self, File};
use std::io; use std::io;
pub fn open(cache: &Path, sri: &Integrity) -> io::Result<File> { pub fn open(cache: &Path, sri: &Integrity) -> io::Result<File> {
File::open(content_path(&cache, &sri)) File::open(path::content_path(&cache, &sri))
} }
pub fn read(cache: &Path, sri: &Integrity) -> io::Result<Vec<u8>> { pub fn read(cache: &Path, sri: &Integrity) -> io::Result<Vec<u8>> {
fs::read(content_path(&cache, &sri)) fs::read(path::content_path(&cache, &sri))
} }
pub fn read_to_string(cache: &Path, sri: &Integrity) -> io::Result<String> { pub fn read_to_string(cache: &Path, sri: &Integrity) -> io::Result<String> {
fs::read_to_string(content_path(&cache, &sri)) fs::read_to_string(path::content_path(&cache, &sri))
} }
pub fn copy(cache: &Path, sri: &Integrity, to: &Path) -> io::Result<u64> { pub fn copy(cache: &Path, sri: &Integrity, to: &Path) -> io::Result<u64> {
fs::copy(content_path(&cache, &sri), to) fs::copy(path::content_path(&cache, &sri), to)
} }
pub fn has_content(cache: &Path, sri: &Integrity) -> Option<Integrity> { pub fn has_content(cache: &Path, sri: &Integrity) -> Option<Integrity> {
if content_path(&cache, &sri).exists() { if path::content_path(&cache, &sri).exists() {
Some(sri.clone()) Some(sri.clone())
} else { } else {
None None