1#[cfg(feature = "toml")]
4mod package;
5
6pub mod kind;
7pub mod license;
8pub mod manifest;
9pub mod name;
10pub mod source;
11pub mod version;
12
13use self::kind::{App, Exe, Font, Lib};
14
15#[doc(inline)]
16pub use self::{
17 kind::Kind,
18 license::License,
19 manifest::Manifest,
20 name::Name,
21 source::Source,
22 version::Version,
23};
24
25#[cfg(feature = "toml")]
26#[doc(inline)]
27pub use self::{
28 package::*,
29};
30
31#[derive(Clone, Debug)]
33pub enum Drop {
34 App(App),
36 Exe(Exe),
38 Font(Font),
40 Lib(Lib),
42}
43
44impl From<App> for Drop {
45 #[inline]
46 fn from(drop: App) -> Self {
47 Self::App(drop)
48 }
49}
50
51impl From<Exe> for Drop {
52 #[inline]
53 fn from(drop: Exe) -> Self {
54 Self::Exe(drop)
55 }
56}
57
58impl From<Font> for Drop {
59 #[inline]
60 fn from(drop: Font) -> Self {
61 Self::Font(drop)
62 }
63}
64
65impl From<Lib> for Drop {
66 #[inline]
67 fn from(drop: Lib) -> Self {
68 Self::Lib(drop)
69 }
70}
71
72impl Drop {
73 pub fn query<S>(query: &name::Query<S>) -> Result<Self, ()>
75 where S: AsRef<str>
76 {
77 let query = query.to_ref::<str>();
78 unimplemented!("TODO: Find '{}' drop", query);
79 }
80
81 pub fn kind(&self) -> Kind {
83 match self {
84 Self::App(_) => Kind::App,
85 Self::Exe(_) => Kind::Exe,
86 Self::Font(_) => Kind::Font,
87 Self::Lib(_) => Kind::Lib,
88 }
89 }
90
91 pub fn metadata(&self) -> &Metadata {
93 match self {
94 Self::App(app) => app.metadata(),
95 Self::Exe(exe) => exe.metadata(),
96 Self::Font(font) => font.metadata(),
97 Self::Lib(lib) => lib.metadata(),
98 }
99 }
100}
101
102#[derive(Clone, Debug)]
104pub struct Metadata {
105 pub scope: String,
109 pub name: String,
111}