From 4b5b75abdac9e064b23646bc81e3655f8ce2a024 Mon Sep 17 00:00:00 2001 From: Maik Klein Date: Sat, 21 Apr 2018 11:45:39 +0200 Subject: [PATCH] Add registry --- Cargo.toml | 3 ++- vk-registry/Cargo.toml | 9 +++++++++ vk-registry/src/data.rs | 41 +++++++++++++++++++++++++++++++++++++++++ vk-registry/src/lib.rs | 6 ++++++ 4 files changed, 58 insertions(+), 1 deletion(-) create mode 100644 vk-registry/Cargo.toml create mode 100644 vk-registry/src/data.rs create mode 100644 vk-registry/src/lib.rs diff --git a/Cargo.toml b/Cargo.toml index d99ff9a..f267469 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,5 +1,6 @@ [workspace] members = [ "examples", - "ash" + "ash", + "vk-registry", ] diff --git a/vk-registry/Cargo.toml b/vk-registry/Cargo.toml new file mode 100644 index 0000000..3c5bd53 --- /dev/null +++ b/vk-registry/Cargo.toml @@ -0,0 +1,9 @@ +[package] +name = "vk-registry" +version = "0.1.0" +authors = ["Maik Klein "] + +[dependencies] + +xml-rs = "0.7" +failure = "0.1.1" diff --git a/vk-registry/src/data.rs b/vk-registry/src/data.rs new file mode 100644 index 0000000..7f41874 --- /dev/null +++ b/vk-registry/src/data.rs @@ -0,0 +1,41 @@ +use std::path::Path; +use std::io::Read; +use failure::Error; +use xml; +pub struct VendorId { + pub name: String, + pub id: String, + pub comment: String, +} +impl VendorId { + pub fn from_xml>(path: P) -> Self { + unimplemented!() + } +} + +pub struct VendorIds { + pub vendor_ids: Vec, +} +impl VendorIds{ + pub fn from_xml>(path: P) -> Self { + unimplemented!() + } +} + +pub struct Registry { + pub vendor_ids: VendorIds, +} + +impl Registry { + pub fn from_xml>(path: P) -> Result { + fn inner(path: &Path) -> Result { + use std::fs::File; + use std::io::BufReader; + let file = File::open(path)?; + let buf_reader = BufReader::new(file); + let event_reader = xml::EventReader::new(buf_reader); + unimplemented!() + } + inner(path.as_ref()) + } +} diff --git a/vk-registry/src/lib.rs b/vk-registry/src/lib.rs new file mode 100644 index 0000000..dbcde82 --- /dev/null +++ b/vk-registry/src/lib.rs @@ -0,0 +1,6 @@ +extern crate xml; +#[macro_use] +extern crate failure; + + +pub mod data;