aboutsummaryrefslogtreecommitdiff
path: root/mingling_core
diff options
context:
space:
mode:
author魏曹先生 <1992414357@qq.com>2026-08-14 18:24:44 +0800
committer魏曹先生 <1992414357@qq.com>2026-08-14 18:24:44 +0800
commit69b8d791364b18dc76be6f59ce3f0c67f630ab2a (patch)
tree241a7c645b3b9901df588b44387e8e8318c421aa /mingling_core
parent5302a368daf7890fa51da640a047d5b71603b660 (diff)
docs: add StringVec documentation and usage examples
Diffstat (limited to 'mingling_core')
-rw-r--r--mingling_core/src/program/string_vec.rs43
1 files changed, 42 insertions, 1 deletions
diff --git a/mingling_core/src/program/string_vec.rs b/mingling_core/src/program/string_vec.rs
index 7af4bec..d38be85 100644
--- a/mingling_core/src/program/string_vec.rs
+++ b/mingling_core/src/program/string_vec.rs
@@ -1,7 +1,48 @@
-// Doc Not Optimize
+/// A type wrapper around `Vec<String>`.
+///
+/// `StringVec` simplifies the process of creating a `Vec<String>` from various
+/// string collection types (such as arrays, slices, `Vec<&str>`, `Vec<String>`, etc.)
+/// by providing multiple convenient `From` conversion implementations.
+/// It also implements [`Deref`] and `Into<Vec<String>>`, allowing you to manipulate it
+/// just like a regular `Vec<String>`.
+///
+/// # Examples
+///
+/// ```
+/// # use mingling_core::StringVec;
+/// // Create from a string array
+/// let sv = StringVec::from(["hello", "world"]);
+///
+/// // Has the Deref behavior of a regular Vec, can be used like a Vec<String>
+/// assert_eq!(sv.len(), 2);
+/// assert_eq!(sv[0], "hello");
+///
+/// // Iterate
+/// for s in sv.iter() {
+/// println!("{}", s);
+/// }
+///
+/// // Convert back to Vec<String>
+/// let v: Vec<String> = sv.into();
+/// assert_eq!(v, vec!["hello".to_string(), "world".to_string()]);
+/// ```
+///
+/// # Supported conversion sources
+///
+/// - `[&str; N]`: fixed-length string literal arrays
+/// - `&[&str]`: string literal slice references
+/// - `Vec<&str>`: string literal dynamic arrays
+/// - `Vec<String>`: `String` dynamic arrays (moved directly, no copy)
+/// - `&[String]`: `String` slice references (shallow copies elements)
+///
+/// # Notes
+///
+/// This type is marked as `#[doc(hidden)]`, typically used internally
+/// and not usually shown directly in public documentation.
#[derive(Debug, Clone)]
#[doc(hidden)]
pub struct StringVec {
+ /// The internally stored actual string vector.
vec: Vec<String>,
}