Add registry
This commit is contained in:
parent
f2e8e7d542
commit
4b5b75abda
4 changed files with 58 additions and 1 deletions
|
@ -1,5 +1,6 @@
|
|||
[workspace]
|
||||
members = [
|
||||
"examples",
|
||||
"ash"
|
||||
"ash",
|
||||
"vk-registry",
|
||||
]
|
||||
|
|
9
vk-registry/Cargo.toml
Normal file
9
vk-registry/Cargo.toml
Normal file
|
@ -0,0 +1,9 @@
|
|||
[package]
|
||||
name = "vk-registry"
|
||||
version = "0.1.0"
|
||||
authors = ["Maik Klein <maikklein@googlemail.com>"]
|
||||
|
||||
[dependencies]
|
||||
|
||||
xml-rs = "0.7"
|
||||
failure = "0.1.1"
|
41
vk-registry/src/data.rs
Normal file
41
vk-registry/src/data.rs
Normal file
|
@ -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<P: AsRef<Path>>(path: P) -> Self {
|
||||
unimplemented!()
|
||||
}
|
||||
}
|
||||
|
||||
pub struct VendorIds {
|
||||
pub vendor_ids: Vec<VendorId>,
|
||||
}
|
||||
impl VendorIds{
|
||||
pub fn from_xml<P: AsRef<Path>>(path: P) -> Self {
|
||||
unimplemented!()
|
||||
}
|
||||
}
|
||||
|
||||
pub struct Registry {
|
||||
pub vendor_ids: VendorIds,
|
||||
}
|
||||
|
||||
impl Registry {
|
||||
pub fn from_xml<P: AsRef<Path>>(path: P) -> Result<Registry, Error> {
|
||||
fn inner(path: &Path) -> Result<Registry, Error> {
|
||||
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())
|
||||
}
|
||||
}
|
6
vk-registry/src/lib.rs
Normal file
6
vk-registry/src/lib.rs
Normal file
|
@ -0,0 +1,6 @@
|
|||
extern crate xml;
|
||||
#[macro_use]
|
||||
extern crate failure;
|
||||
|
||||
|
||||
pub mod data;
|
Loading…
Add table
Reference in a new issue