Mike Gerwitz

Activist for User Freedom

aboutsummaryrefslogtreecommitdiffstats
path: root/tamer
diff options
context:
space:
mode:
authorMike Gerwitz <mike.gerwitz@ryansg.com>2020-04-06 13:39:13 -0400
committerMike Gerwitz <mike.gerwitz@ryansg.com>2020-04-20 10:53:51 -0400
commit90ed4e9bd623cc85b8247d98551dc035216ebde0 (patch)
tree6994d3359dcba281a242157305be26dea3fda507 /tamer
parent3ba587c9f9125ade32deb97d361a10eaf4e4c126 (diff)
downloadtame-90ed4e9bd623cc85b8247d98551dc035216ebde0.tar.gz
tame-90ed4e9bd623cc85b8247d98551dc035216ebde0.tar.bz2
tame-90ed4e9bd623cc85b8247d98551dc035216ebde0.zip
[DEV-7084] TAMER: From<B, &I> for XmloReader
This serves as a constructor for the time being, decoupling from POC. We may do something better once we have a better idea of how the various abstractions around this will evolve.
Diffstat (limited to 'tamer')
-rw-r--r--tamer/src/ld/poc.rs2
-rw-r--r--tamer/src/obj/xmlo/reader.rs10
2 files changed, 11 insertions, 1 deletions
diff --git a/tamer/src/ld/poc.rs b/tamer/src/ld/poc.rs
index c75aacb..5720f79 100644
--- a/tamer/src/ld/poc.rs
+++ b/tamer/src/ld/poc.rs
@@ -140,7 +140,7 @@ fn load_xmlo<'a, 'i, I: Interner<'i>>(
let file = fs::File::open(&path)?;
let reader = BufReader::new(file);
- let mut xmlo = XmloReader::new(reader, interner);
+ let mut xmlo: XmloReader<'_, _, _> = (reader, interner).into();
let mut elig = None;
let mut name: Option<&'i Symbol<'i>> = None;
diff --git a/tamer/src/obj/xmlo/reader.rs b/tamer/src/obj/xmlo/reader.rs
index ded13c0..ee944a8 100644
--- a/tamer/src/obj/xmlo/reader.rs
+++ b/tamer/src/obj/xmlo/reader.rs
@@ -684,6 +684,16 @@ impl<'i, B: BufRead, I: Interner<'i>> XmloReader<'i, B, I> {
}
}
+impl<'i, B, I> From<(B, &'i I)> for XmloReader<'i, B, I>
+where
+ B: BufRead,
+ I: Interner<'i>,
+{
+ fn from(args: (B, &'i I)) -> Self {
+ Self::new(args.0, args.1)
+ }
+}
+
/// `xmlo` reader events.
///
/// All data are parsed rather than being returned as [`u8`] slices,