Skip to main content

QasmSourceResolver

Trait QasmSourceResolver 

Source
pub trait QasmSourceResolver {
    // Required method
    fn resolve_source(&self, path: &Path) -> Result<String, Error>;
}
Expand description

Trait for abstracting file system access during OpenQASM parsing.

This allows the parser to work in different environments:

  • Real file system (use FileSystemResolver)
  • Memory-only mode (use NullResolver)
  • Custom resolvers for WASM or embedded files

Required Methods§

Source

fn resolve_source(&self, path: &Path) -> Result<String, Error>

Resolve the content of a file given its path.

§Arguments
  • path - The file path to resolve
§Returns
  • Ok(String) - The file contents
  • Err(io::Error) - I/O error if resolution fails

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§