aboutsummaryrefslogtreecommitdiff
path: root/mingling_core/src/program/string_vec.rs
diff options
context:
space:
mode:
author魏曹先生 <1992414357@qq.com>2026-04-22 13:27:43 +0800
committer魏曹先生 <1992414357@qq.com>2026-04-22 13:30:13 +0800
commit3785202ec5b949cba5501b20729b16f4c29ea626 (patch)
tree2a276df54128e73557463af54d626a1a7c250e94 /mingling_core/src/program/string_vec.rs
parentc2f9fb47832c5e12fe37762616c81b016de00464 (diff)
Add new_with_args and dispatch_args_dynamic to Program
Remove Display bound from Group type parameter and delete dispatcher_render macro. This is a breaking change.
Diffstat (limited to 'mingling_core/src/program/string_vec.rs')
-rw-r--r--mingling_core/src/program/string_vec.rs56
1 files changed, 56 insertions, 0 deletions
diff --git a/mingling_core/src/program/string_vec.rs b/mingling_core/src/program/string_vec.rs
new file mode 100644
index 0000000..478ad74
--- /dev/null
+++ b/mingling_core/src/program/string_vec.rs
@@ -0,0 +1,56 @@
+#[derive(Debug, Clone)]
+pub struct StringVec {
+ vec: Vec<String>,
+}
+
+impl std::ops::Deref for StringVec {
+ type Target = Vec<String>;
+
+ fn deref(&self) -> &Self::Target {
+ &self.vec
+ }
+}
+
+impl From<StringVec> for Vec<String> {
+ fn from(val: StringVec) -> Self {
+ val.vec
+ }
+}
+
+impl<const N: usize> From<[&str; N]> for StringVec {
+ fn from(slice: [&str; N]) -> Self {
+ StringVec {
+ vec: slice.iter().map(|&s| s.to_string()).collect(),
+ }
+ }
+}
+
+impl From<&[&str]> for StringVec {
+ fn from(slice: &[&str]) -> Self {
+ StringVec {
+ vec: slice.iter().map(|&s| s.to_string()).collect(),
+ }
+ }
+}
+
+impl From<Vec<String>> for StringVec {
+ fn from(vec: Vec<String>) -> Self {
+ StringVec { vec }
+ }
+}
+
+impl From<&[String]> for StringVec {
+ fn from(slice: &[String]) -> Self {
+ StringVec {
+ vec: slice.to_vec(),
+ }
+ }
+}
+
+impl From<Vec<&str>> for StringVec {
+ fn from(vec: Vec<&str>) -> Self {
+ StringVec {
+ vec: vec.iter().map(|&s| s.to_string()).collect(),
+ }
+ }
+}