(fs: Vec<IDLField>)
| 150 | } |
| 151 | |
| 152 | fn from_fields(fs: Vec<IDLField>) -> Vec<IDLValue> { |
| 153 | fs.into_iter() |
| 154 | .map(|f| { |
| 155 | IDLValue::Record(vec![ |
| 156 | IDLField { |
| 157 | id: Label::Id(0), |
| 158 | val: IDLValue::Text(format!("{}", f.id)), |
| 159 | }, |
| 160 | IDLField { |
| 161 | id: Label::Id(1), |
| 162 | val: f.val, |
| 163 | }, |
| 164 | ]) |
| 165 | }) |
| 166 | .collect() |
| 167 | } |
| 168 | fn from_text(s: String) -> Vec<IDLValue> { |
| 169 | s.chars().map(|c| IDLValue::Text(c.to_string())).collect() |
| 170 | } |