Debian Codegraph @

src/sources.rs

raw symbols SCIP
1 use stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::fsrust-analyzer cargo std https://github.com/rust-lang/rust/library/std fs/::Filerust-analyzer cargo std https://github.com/rust-lang/rust/library/std fs/File#;
2 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/::{BufReaderrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/buffered/bufreader/BufReader#, Errorrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/error/Error# as IOErrorrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/error/Error#, ErrorKindrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/error/ErrorKind#, Readrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/Read#};
3 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/::PathBufrust-analyzer cargo std https://github.com/rust-lang/rust/library/std path/PathBuf#;
4
5 pub(craterust-analyzer cargo handlebars 5.1.2 crate/) trait Sourcerust-analyzer cargo handlebars 5.1.2 sources/Source# {
6 type Itemrust-analyzer cargo handlebars 5.1.2 sources/Source#Item#;
7 type Errorrust-analyzer cargo handlebars 5.1.2 sources/Source#Error#;
8
9 fn loadrust-analyzer cargo handlebars 5.1.2 sources/Source#load().(&self) -> Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#<Self::Itemrust-analyzer cargo handlebars 5.1.2 sources/Source#Item#, Self::Errorrust-analyzer cargo handlebars 5.1.2 sources/Source#Error#>;
10 }
11
12 pub(craterust-analyzer cargo handlebars 5.1.2 crate/) struct FileSourcerust-analyzer cargo handlebars 5.1.2 sources/FileSource# {
13 pathrust-analyzer cargo handlebars 5.1.2 sources/FileSource#path.: PathBufrust-analyzer cargo std https://github.com/rust-lang/rust/library/std path/PathBuf#,
14 }
15
16 impl FileSourcerust-analyzer cargo handlebars 5.1.2 sources/FileSource# {
17 pub(craterust-analyzer cargo handlebars 5.1.2 crate/) fn newrust-analyzer cargo handlebars 5.1.2 sources/impl#[FileSource]new().(path: PathBufrust-analyzer cargo std https://github.com/rust-lang/rust/library/std path/PathBuf#) -> FileSourcerust-analyzer cargo handlebars 5.1.2 sources/FileSource# {
18 FileSourcerust-analyzer cargo handlebars 5.1.2 sources/FileSource# { pathrust-analyzer cargo handlebars 5.1.2 sources/FileSource#path. }
19 }
20 }
21
22 impl Sourcerust-analyzer cargo handlebars 5.1.2 sources/Source# for FileSourcerust-analyzer cargo handlebars 5.1.2 sources/FileSource# {
23 type Itemrust-analyzer cargo handlebars 5.1.2 sources/impl#[FileSource][Source]Item# = Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#;
24 type Errorrust-analyzer cargo handlebars 5.1.2 sources/impl#[FileSource][Source]Error# = IOErrorrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/error/Error#;
25
26 fn loadrust-analyzer cargo handlebars 5.1.2 sources/impl#[FileSource][Source]load().(&self) -> Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#<Selfrust-analyzer cargo handlebars 5.1.2 sources/impl#[FileSource][Source]::Itemrust-analyzer cargo handlebars 5.1.2 sources/Source#Item#, Selfrust-analyzer cargo handlebars 5.1.2 sources/impl#[FileSource][Source]::Errorrust-analyzer cargo handlebars 5.1.2 sources/Source#Error#> {
27 let mut reader = BufReaderrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/buffered/bufreader/BufReader#::newrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/buffered/bufreader/impl#[`BufReader<R>`]new().(Filerust-analyzer cargo std https://github.com/rust-lang/rust/library/std fs/File#::openrust-analyzer cargo std https://github.com/rust-lang/rust/library/std fs/impl#[File]open().(&self.pathrust-analyzer cargo handlebars 5.1.2 sources/FileSource#path.)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().);
28
29 let mut buf = Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#::newrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String]new().();
30 reader.read_to_stringrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/buffered/bufreader/impl#[`BufReader<R>`][Read]read_to_string().(&mut buf)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().;
31
32 Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(buf)
33 }
34 }
35
36 pub(craterust-analyzer cargo handlebars 5.1.2 crate/) struct LazySourcerust-analyzer cargo handlebars 5.1.2 sources/LazySource#<F: Fnrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/function/Fn#() -> Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#>> {
37 loaderrust-analyzer cargo handlebars 5.1.2 sources/LazySource#loader.: F,
38 }
39
40 impl<F: Fnrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/function/Fn#() -> Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#>> LazySourcerust-analyzer cargo handlebars 5.1.2 sources/LazySource#<F> {
41 pub(craterust-analyzer cargo handlebars 5.1.2 crate/) fn newrust-analyzer cargo handlebars 5.1.2 sources/impl#[`LazySource<F>`]new().(loader: F) -> LazySourcerust-analyzer cargo handlebars 5.1.2 sources/LazySource#<F> {
42 LazySourcerust-analyzer cargo handlebars 5.1.2 sources/LazySource# { loaderrust-analyzer cargo handlebars 5.1.2 sources/LazySource#loader. }
43 }
44 }
45
46 impl<F: Fnrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/function/Fn#() -> Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#>> Sourcerust-analyzer cargo handlebars 5.1.2 sources/Source# for LazySourcerust-analyzer cargo handlebars 5.1.2 sources/LazySource#<F> {
47 type Itemrust-analyzer cargo handlebars 5.1.2 sources/impl#[`LazySource<F>`][Source]Item# = Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#;
48 type Errorrust-analyzer cargo handlebars 5.1.2 sources/impl#[`LazySource<F>`][Source]Error# = IOErrorrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/error/Error#;
49
50 fn loadrust-analyzer cargo handlebars 5.1.2 sources/impl#[`LazySource<F>`][Source]load().(&self) -> Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#<Selfrust-analyzer cargo handlebars 5.1.2 sources/impl#[`LazySource<F>`][Source]::Itemrust-analyzer cargo handlebars 5.1.2 sources/Source#Item#, Selfrust-analyzer cargo handlebars 5.1.2 sources/impl#[`LazySource<F>`][Source]::Errorrust-analyzer cargo handlebars 5.1.2 sources/Source#Error#> {
51 (self.loaderrust-analyzer cargo handlebars 5.1.2 sources/LazySource#loader.)().ok_orrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]ok_or().(IOErrorrust-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().(ErrorKindrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/error/ErrorKind#::Otherrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/error/ErrorKind#Other#, "Source load error"))
52 }
53 }