forked from tafia/quick-xml
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
added EntityResolver to Deserializer
- Loading branch information
1 parent
2e9123a
commit ddacb31
Showing
5 changed files
with
71 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
//! Entity resolver module | ||
//! | ||
|
||
/// Used to resolve unknown entities while parsing | ||
pub trait EntityResolver<'entity_out> { | ||
/// Called when an entity needs to be resolved. | ||
/// None is retuned if a sutable value can not be found. | ||
fn resolve_entity(&mut self, entity: &str) -> Option<&'entity_out str>; | ||
} | ||
|
||
/// An EntityResolver that always returns None. | ||
#[derive(Default, Copy, Clone)] | ||
pub struct DefaultEntityResolver; | ||
|
||
impl<'entity_out> EntityResolver<'entity_out> for DefaultEntityResolver{ | ||
fn resolve_entity(&mut self, _: &str) -> Option<&'entity_out str> { | ||
None | ||
} | ||
} |