@@ -1041,6 +1041,43 @@ impl<T> MaybeWorkspace<T> {
1041
1041
}
1042
1042
}
1043
1043
1044
+ fn maybe_workspace_vec_string < ' de , D > (
1045
+ deserializer : D ,
1046
+ ) -> Result < Option < MaybeWorkspace < Vec < String > > > , D :: Error >
1047
+ where
1048
+ D : de:: Deserializer < ' de > ,
1049
+ {
1050
+ struct Visitor ;
1051
+
1052
+ impl < ' de > de:: Visitor < ' de > for Visitor {
1053
+ type Value = Option < MaybeWorkspace < Vec < String > > > ;
1054
+
1055
+ fn expecting ( & self , formatter : & mut fmt:: Formatter < ' _ > ) -> fmt:: Result {
1056
+ formatter. write_str ( "vector of strings" )
1057
+ }
1058
+
1059
+ fn visit_seq < V > ( self , v : V ) -> Result < Self :: Value , V :: Error >
1060
+ where
1061
+ V : de:: SeqAccess < ' de > ,
1062
+ {
1063
+ let seq = de:: value:: SeqAccessDeserializer :: new ( v) ;
1064
+ let defined = Vec :: < String > :: deserialize ( seq) . map ( MaybeWorkspace :: Defined ) ?;
1065
+ Ok ( Some ( defined) )
1066
+ }
1067
+
1068
+ fn visit_map < V > ( self , map : V ) -> Result < Self :: Value , V :: Error >
1069
+ where
1070
+ V : de:: MapAccess < ' de > ,
1071
+ {
1072
+ let mvd = de:: value:: MapAccessDeserializer :: new ( map) ;
1073
+ let workspace = TomlWorkspaceField :: deserialize ( mvd) . map ( MaybeWorkspace :: Workspace ) ?;
1074
+ Ok ( Some ( workspace) )
1075
+ }
1076
+ }
1077
+
1078
+ deserializer. deserialize_any ( Visitor )
1079
+ }
1080
+
1044
1081
#[ derive( Deserialize , Serialize , Clone , Debug ) ]
1045
1082
pub struct TomlWorkspaceField {
1046
1083
workspace : bool ,
@@ -1060,6 +1097,8 @@ pub struct TomlProject {
1060
1097
name : InternedString ,
1061
1098
#[ serde( deserialize_with = "version_trim_whitespace" ) ]
1062
1099
version : MaybeWorkspace < semver:: Version > ,
1100
+ #[ serde( default ) ]
1101
+ #[ serde( deserialize_with = "maybe_workspace_vec_string" ) ]
1063
1102
authors : Option < MaybeWorkspace < Vec < String > > > ,
1064
1103
build : Option < StringOrBool > ,
1065
1104
metabuild : Option < StringOrVec > ,
@@ -1068,7 +1107,11 @@ pub struct TomlProject {
1068
1107
#[ serde( rename = "forced-target" ) ]
1069
1108
forced_target : Option < String > ,
1070
1109
links : Option < String > ,
1110
+ #[ serde( default ) ]
1111
+ #[ serde( deserialize_with = "maybe_workspace_vec_string" ) ]
1071
1112
exclude : Option < MaybeWorkspace < Vec < String > > > ,
1113
+ #[ serde( default ) ]
1114
+ #[ serde( deserialize_with = "maybe_workspace_vec_string" ) ]
1072
1115
include : Option < MaybeWorkspace < Vec < String > > > ,
1073
1116
publish : Option < MaybeWorkspace < VecStringOrBool > > ,
1074
1117
workspace : Option < String > ,
@@ -1084,7 +1127,11 @@ pub struct TomlProject {
1084
1127
homepage : Option < MaybeWorkspace < String > > ,
1085
1128
documentation : Option < MaybeWorkspace < String > > ,
1086
1129
readme : Option < MaybeWorkspace < StringOrBool > > ,
1130
+ #[ serde( default ) ]
1131
+ #[ serde( deserialize_with = "maybe_workspace_vec_string" ) ]
1087
1132
keywords : Option < MaybeWorkspace < Vec < String > > > ,
1133
+ #[ serde( default ) ]
1134
+ #[ serde( deserialize_with = "maybe_workspace_vec_string" ) ]
1088
1135
categories : Option < MaybeWorkspace < Vec < String > > > ,
1089
1136
license : Option < MaybeWorkspace < String > > ,
1090
1137
license_file : Option < MaybeWorkspace < String > > ,
0 commit comments