mirror of https://github.com/zkat/cacache-rs.git
refactor(read): follow convention for imports
This commit is contained in:
parent
bff95f20ec
commit
837e90b484
|
|
@ -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
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue