MCPcopy Create free account
hub / github.com/Stranger6667/css-inline / retrieve

Method retrieve

css-inline/src/resolver.rs:11–40  ·  view source on GitHub ↗

Retrieve a stylesheet from a network or local filesystem location. # Errors Any network or filesystem related error, or an error during response parsing.

(&self, location: &str)

Source from the content-addressed store, hash-verified

9 ///
10 /// Any network or filesystem related error, or an error during response parsing.
11 fn retrieve(&self, location: &str) -> Result<String> {
12 if location.starts_with("https") || location.starts_with("http") {
13 #[cfg(feature = "http")]
14 {
15 self.retrieve_from_url(location)
16 }
17
18 #[cfg(not(feature = "http"))]
19 {
20 Err(std::io::Error::new(
21 ErrorKind::Unsupported,
22 "Loading external URLs requires the `http` feature",
23 )
24 .into())
25 }
26 } else {
27 #[cfg(feature = "file")]
28 {
29 self.retrieve_from_path(location)
30 }
31 #[cfg(not(feature = "file"))]
32 {
33 Err(std::io::Error::new(
34 ErrorKind::Unsupported,
35 "Loading local files requires the `file` feature",
36 )
37 .into())
38 }
39 }
40 }
41 /// Retrieve a stylesheet from a network location.
42 ///
43 /// # Errors

Callers 1

inline_to_implMethod · 0.45

Implementers 4

resolver.rscss-inline/src/resolver.rs
test_cachecss-inline/tests/test_inlining.rs
test_resolver_without_implementationcss-inline/tests/test_inlining.rs
try_frombindings/javascript/src/options.rs

Calls 2

retrieve_from_pathMethod · 0.80
retrieve_from_urlMethod · 0.45

Tested by

no test coverage detected