pathbuf for input
This commit is contained in:
parent
069c559804
commit
a64d2f7b01
@ -4,17 +4,18 @@ pub use bytes::BytesInput;
|
|||||||
use std::fs::File;
|
use std::fs::File;
|
||||||
use std::io::Read;
|
use std::io::Read;
|
||||||
use std::io::Write;
|
use std::io::Write;
|
||||||
|
use std::path::PathBuf;
|
||||||
|
|
||||||
use crate::AflError;
|
use crate::AflError;
|
||||||
|
|
||||||
pub trait Input {
|
pub trait Input {
|
||||||
fn to_file(&self, path: &str) -> Result<(), AflError> {
|
fn to_file(&self, path: &PathBuf) -> Result<(), AflError> {
|
||||||
let mut file = File::create(path)?;
|
let mut file = File::create(path)?;
|
||||||
file.write_all(self.serialize()?)?;
|
file.write_all(self.serialize()?)?;
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
fn from_file(&mut self, path: &str) -> Result<(), AflError> {
|
fn from_file(&mut self, path: &PathBuf) -> Result<(), AflError> {
|
||||||
let mut file = File::create(path)?;
|
let mut file = File::create(path)?;
|
||||||
let mut buf = vec![];
|
let mut buf = vec![];
|
||||||
file.read_to_end(&mut buf)?;
|
file.read_to_end(&mut buf)?;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user