xsd_parser/pipeline/parser/resolver/
noop_resolver.rs

1use std::io::{BufRead, Error, ErrorKind};
2
3use super::{ResolveRequest, ResolveResult, Resolver};
4
5/// Implements a [`Resolver`] that resolves nothing.
6///
7/// This is the default resolver that is used if no other resolver was provided.
8#[must_use]
9#[derive(Default, Debug)]
10pub struct NoOpResolver;
11
12impl NoOpResolver {
13    /// Create a new [`NoOpResolver`] resolver instance.
14    pub fn new() -> Self {
15        Self
16    }
17}
18
19impl Resolver for NoOpResolver {
20    type Buffer = Box<dyn BufRead + 'static>;
21    type Error = Error;
22
23    fn resolve(&mut self, req: &ResolveRequest) -> ResolveResult<Self> {
24        Err(Error::new(
25            ErrorKind::NotFound,
26            format!("Unable to resolve requested location: {req}"),
27        ))
28    }
29}