Struct file_content::File
source · pub struct File {
pub path: PathBuf,
pub content: FileContent,
}
Expand description
A file representation that can be used to pair a file path with its content. File provides convenience methods for working with files on disk, or in memory.
Fields§
§path: PathBuf
§content: FileContent
Implementations§
source§impl File
impl File
sourcepub fn new(
path: impl Into<PathBuf>,
input: impl Read
) -> Result<Self, FileError>
pub fn new( path: impl Into<PathBuf>, input: impl Read ) -> Result<Self, FileError>
Create a File with the given path and read it’s content from the input std::io::Read. The encoding is detected as we read the content, and the appropriate FileContent is used.
pub fn new_from_path(path: impl Into<PathBuf>) -> Result<Self, FileError>
Trait Implementations§
source§impl PartialEq for File
impl PartialEq for File
impl StructuralPartialEq for File
Auto Trait Implementations§
impl Freeze for File
impl RefUnwindSafe for File
impl Send for File
impl Sync for File
impl Unpin for File
impl UnwindSafe for File
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more