| 169 | s.chars().map(|c| IDLValue::Text(c.to_string())).collect() |
| 170 | } |
| 171 | fn to_text(from: Vec<IDLValue>) -> Result<String> { |
| 172 | use std::fmt::Write; |
| 173 | let mut res = String::with_capacity(from.len()); |
| 174 | for v in from.into_iter() { |
| 175 | if let IDLValue::Text(s) = v { |
| 176 | write!(&mut res, "{s}")?; |
| 177 | } else { |
| 178 | return Err(anyhow!("expect function to return text")); |
| 179 | } |
| 180 | } |
| 181 | Ok(res) |
| 182 | } |
| 183 | fn to_field(from: Vec<IDLValue>) -> Result<Vec<IDLField>> { |
| 184 | let mut fs = Vec::with_capacity(from.len()); |
| 185 | for v in from.into_iter() { |