-
Notifications
You must be signed in to change notification settings - Fork 95
/
mod.rs
40 lines (37 loc) · 1.42 KB
/
mod.rs
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
31
32
33
34
35
36
37
38
39
40
use toml::value::{Table, Value};
use super::Options;
mod pkg_status;
mod temp_project;
mod elaborate_workspace;
pub use self::pkg_status::*;
pub use self::temp_project::TempProject;
pub use self::elaborate_workspace::ElaborateWorkspace;
/// A continent struct for quick parsing and manipulating manifest
#[derive(Debug, Serialize, Deserialize)]
struct Manifest {
pub package: Value,
#[serde(skip_serializing_if = "Option::is_none", serialize_with = "opt_tables_last")]
pub dependencies: Option<Table>,
#[serde(rename = "dev-dependencies", skip_serializing_if = "Option::is_none",
serialize_with = "opt_tables_last")]
pub dev_dependencies: Option<Table>,
#[serde(rename = "build-dependencies", skip_serializing_if = "Option::is_none",
serialize_with = "opt_tables_last")]
pub build_dependencies: Option<Table>,
pub lib: Option<Table>,
pub bin: Option<Vec<Table>>,
#[serde(skip_serializing_if = "Option::is_none", serialize_with = "opt_tables_last")]
pub workspace: Option<Table>,
#[serde(skip_serializing_if = "Option::is_none", serialize_with = "opt_tables_last")]
pub target: Option<Table>,
pub features: Option<Value>,
}
pub fn opt_tables_last<S>(data: &Option<Table>, serializer: S) -> Result<S::Ok, S::Error>
where
S: ::serde::ser::Serializer,
{
match *data {
Some(ref d) => ::toml::ser::tables_last(d, serializer),
None => unreachable!(),
}
}