From 3785202ec5b949cba5501b20729b16f4c29ea626 Mon Sep 17 00:00:00 2001 From: 魏曹先生 <1992414357@qq.com> Date: Wed, 22 Apr 2026 13:27:43 +0800 Subject: 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. --- mingling_core/src/program/string_vec.rs | 56 +++++++++++++++++++++++++++++++++ 1 file changed, 56 insertions(+) create mode 100644 mingling_core/src/program/string_vec.rs (limited to 'mingling_core/src/program/string_vec.rs') 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, +} + +impl std::ops::Deref for StringVec { + type Target = Vec; + + fn deref(&self) -> &Self::Target { + &self.vec + } +} + +impl From for Vec { + fn from(val: StringVec) -> Self { + val.vec + } +} + +impl 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> for StringVec { + fn from(vec: Vec) -> Self { + StringVec { vec } + } +} + +impl From<&[String]> for StringVec { + fn from(slice: &[String]) -> Self { + StringVec { + vec: slice.to_vec(), + } + } +} + +impl From> for StringVec { + fn from(vec: Vec<&str>) -> Self { + StringVec { + vec: vec.iter().map(|&s| s.to_string()).collect(), + } + } +} -- cgit