1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
use crate::cargo::toml;
use std::path::{Path, PathBuf};
use std::ops::Deref;
#[derive(Clone, Debug)]
#[non_exhaustive]
pub struct Package<PackageMetadata = ::toml::value::Table> {
pub(crate) path: PathBuf,
pub(crate) toml: toml::Cargo<toml::Package<PackageMetadata>, ()>,
}
impl<PM> Package<PM> {
pub fn manifest_path(&self) -> &Path { &self.path }
pub fn directory(&self) -> &Path { self.path.parent().unwrap() }
pub fn toml(&self) -> &toml::Cargo<toml::Package<PM>, ()> { &self.toml }
}
impl<PM> Deref for Package<PM> {
type Target = toml::Cargo<toml::Package<PM>, ()>;
fn deref(&self) -> &toml::Cargo<toml::Package<PM>, ()> { &self.toml }
}