Host-injected trait; resolve called once per import statement. &mut self allows internal caching. */
| 87 | |
| 88 | /* Host-injected trait; resolve called once per import statement. &mut self allows internal caching. */ |
| 89 | pub trait Resolver { |
| 90 | fn resolve(&mut self, spec: &str) -> Result<Resolved, String>; |
| 91 | |
| 92 | /* Returns a child resolver rescoped to the imported file's directory for transitive imports; default is NoopResolver. */ |
| 93 | fn child(&self, _spec: &str) -> Box<dyn Resolver> { |
| 94 | Box::new(NoopResolver) |
| 95 | } |
| 96 | |
| 97 | /* Returns raw bytes for integrity verification and manifest walk-up; Err signals absent file. expected_hash must match. */ |
| 98 | fn fetch_bytes(&mut self, _spec: &str, _expected_hash: Option<[u8; 32]>) -> Result<alloc::vec::Vec<u8>, String> { |
| 99 | Err(s!("module '", str _spec, "' integrity verification not supported by this resolver")) |
| 100 | } |
| 101 | } |
| 102 | |
| 103 | /* Splits spec into (url, Option<[u8;32]>); errors on malformed #sha256- fragment; decodes hex once. */ |
| 104 | pub fn parse_integrity(spec: &str) -> Result<(&str, Option<[u8; 32]>), String> { |
no outgoing calls
no test coverage detected