Debian Codegraph @

src/file_error.rs

raw symbols SCIP
1 //! Common error type for file operations.
2
3 use stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::errorrust-analyzer cargo std https://github.com/rust-lang/rust/library/std error/::Errorrust-analyzer cargo core https://github.com/rust-lang/rust/library/core error/Error#;
4 use stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::fmtrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc fmt/;
5 use stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::iorust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/;
6 use stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::pathrust-analyzer cargo std https://github.com/rust-lang/rust/library/std path/::{Pathrust-analyzer cargo std https://github.com/rust-lang/rust/library/std path/Path#, PathBufrust-analyzer cargo std https://github.com/rust-lang/rust/library/std path/PathBuf#};
7
8 /// Common error type for file operations.
9 #[deriverust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/derive:(Debugrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/macros/Debug:)]
10 pub(craterust-analyzer cargo buffered-reader 1.4.1 crate/) struct FileErrorrust-analyzer cargo buffered-reader 1.4.1 file_error/FileError# {
11 pathrust-analyzer cargo buffered-reader 1.4.1 file_error/FileError#path.: PathBufrust-analyzer cargo std https://github.com/rust-lang/rust/library/std path/PathBuf#,
12 sourcerust-analyzer cargo buffered-reader 1.4.1 file_error/FileError#source.: iorust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/::Errorrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/error/Error#,
13 }
14
15 impl FileErrorrust-analyzer cargo buffered-reader 1.4.1 file_error/FileError# {
16 /// Returns a new `io::Error` backed by a `FileError`.
17 pub fn newrust-analyzer cargo buffered-reader 1.4.1 file_error/impl#[FileError]new().<P: AsRefrust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/AsRef#<Pathrust-analyzer cargo std https://github.com/rust-lang/rust/library/std path/Path#>>(path: P, source: iorust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/::Errorrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/error/Error#) -> iorust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/::Errorrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/error/Error# {
18 iorust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/::Errorrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/error/Error#::newrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/error/impl#[Error]new().(source.kindrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/error/impl#[Error]kind().(), FileErrorrust-analyzer cargo buffered-reader 1.4.1 file_error/FileError# {
19 pathrust-analyzer cargo buffered-reader 1.4.1 file_error/FileError#path.: path.as_refrust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/AsRef#as_ref().().intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`Into<U>`]into().(),
20 sourcerust-analyzer cargo buffered-reader 1.4.1 file_error/FileError#source.,
21 })
22 }
23 }
24
25 impl fmtrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc fmt/::Displayrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Display# for FileErrorrust-analyzer cargo buffered-reader 1.4.1 file_error/FileError# {
26 fn fmtrust-analyzer cargo buffered-reader 1.4.1 file_error/impl#[FileError][Display]fmt().(&self, f: &mut fmtrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc fmt/::Formatterrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Formatter#) -> fmtrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc fmt/::Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Result# {
27 writerust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/write!!(f, "Reading {:?}: {}", self.pathrust-analyzer cargo buffered-reader 1.4.1 file_error/FileError#path..displayrust-analyzer cargo std https://github.com/rust-lang/rust/library/std path/impl#[Path]display().(), self.sourcerust-analyzer cargo buffered-reader 1.4.1 file_error/FileError#source.)
28 }
29 }
30
31 impl Errorrust-analyzer cargo core https://github.com/rust-lang/rust/library/core error/Error# for FileErrorrust-analyzer cargo buffered-reader 1.4.1 file_error/FileError# {
32 fn sourcerust-analyzer cargo buffered-reader 1.4.1 file_error/impl#[FileError][Error]source().(&self) -> Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<&(dyn Errorrust-analyzer cargo core https://github.com/rust-lang/rust/library/core error/Error# + 'static)> {
33 Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(&self.sourcerust-analyzer cargo buffered-reader 1.4.1 file_error/FileError#source.)
34 }
35 }