Builds a Python list handle from string items. */
(items: &[String])
| 84 | |
| 85 | /* Builds a Python list handle from string items. */ |
| 86 | fn str_list(items: &[String]) -> Result<Handle> { |
| 87 | let list = Handle::new_list()?; |
| 88 | for s in items { |
| 89 | let h = encode(Value::Bytes(s.clone().into_bytes()))?; |
| 90 | list.call("append", &[h.raw()])?; |
| 91 | } |
| 92 | Ok(list) |
| 93 | } |
| 94 | |
| 95 | /* search: leftmost match anywhere, returns group 0 or None. */ |
| 96 | #[plugin_fn] |