tmr_cargo/
dependencies.rs1use std::path::PathBuf;
2
3use serde::Serialize;
4
5use crate::ToToml;
6
7#[derive(Serialize)]
8pub struct Path(PathBuf);
9
10impl From<PathBuf> for Path {
11 fn from(path: PathBuf) -> Self {
12 Self(path)
13 }
14}
15
16impl ToToml for Path {}
17
18pub struct Version(semver::VersionReq);
19
20impl Serialize for Version {
21 fn serialize<S: serde::Serializer>(&self, serializer: S) -> Result<S::Ok, S::Error> {
22 self.0.to_string().serialize(serializer)
23 }
24}
25
26impl From<semver::VersionReq> for Version {
27 fn from(version: semver::VersionReq) -> Self {
28 Self(version)
29 }
30}
31
32impl ToToml for Version {}
33
34#[derive(Serialize)]
35pub struct Features(Vec<Feature>);
36
37impl From<Vec<&str>> for Features {
38 fn from(features: Vec<&str>) -> Self {
39 Self(
40 features
41 .into_iter()
42 .map(|feature| Feature(feature.to_string()))
43 .collect(),
44 )
45 }
46}
47
48impl From<&[&str]> for Features {
49 fn from(features: &[&str]) -> Self {
50 Self(
51 features
52 .iter()
53 .map(|feature| Feature(feature.to_string()))
54 .collect(),
55 )
56 }
57}
58
59impl ToToml for Features {}
60
61#[derive(Serialize)]
62pub struct Feature(String);
63
64impl ToToml for Feature {}