#[cfg(feature = "toml")]
mod package;
pub mod kind;
pub mod license;
pub mod manifest;
pub mod name;
pub mod source;
pub mod version;
use self::kind::{App, Exe, Font, Lib};
#[doc(inline)]
pub use self::{
kind::Kind,
license::License,
manifest::Manifest,
name::Name,
source::Source,
version::Version,
};
#[cfg(feature = "toml")]
#[doc(inline)]
pub use self::{
package::*,
};
#[derive(Clone, Debug)]
pub enum Drop {
App(App),
Exe(Exe),
Font(Font),
Lib(Lib),
}
impl From<App> for Drop {
#[inline]
fn from(drop: App) -> Self {
Self::App(drop)
}
}
impl From<Exe> for Drop {
#[inline]
fn from(drop: Exe) -> Self {
Self::Exe(drop)
}
}
impl From<Font> for Drop {
#[inline]
fn from(drop: Font) -> Self {
Self::Font(drop)
}
}
impl From<Lib> for Drop {
#[inline]
fn from(drop: Lib) -> Self {
Self::Lib(drop)
}
}
impl Drop {
pub fn query<S>(query: &name::Query<S>) -> Result<Self, ()>
where S: AsRef<str>
{
let query = query.to_ref::<str>();
unimplemented!("TODO: Find '{}' drop", query);
}
pub fn kind(&self) -> Kind {
match self {
Self::App(_) => Kind::App,
Self::Exe(_) => Kind::Exe,
Self::Font(_) => Kind::Font,
Self::Lib(_) => Kind::Lib,
}
}
pub fn metadata(&self) -> &Metadata {
match self {
Self::App(app) => app.metadata(),
Self::Exe(exe) => exe.metadata(),
Self::Font(font) => font.metadata(),
Self::Lib(lib) => lib.metadata(),
}
}
}
#[derive(Clone, Debug)]
pub struct Metadata {
pub scope: String,
pub name: String,
}