diff options
| author | 魏曹先生 <1992414357@qq.com> | 2026-08-14 03:55:51 +0800 |
|---|---|---|
| committer | 魏曹先生 <1992414357@qq.com> | 2026-08-14 03:55:51 +0800 |
| commit | 5aeea111091efbc80d6796c067b586a48930f48e (patch) | |
| tree | 6011c89c302dea173b75525c3d6596d632ab2b76 /mingling_core/src/metadata | |
| parent | 05d802c31a699944182a8e778b51278e1c35a952 (diff) | |
docs(metadata): expand Description documentation with examples and
details
Diffstat (limited to 'mingling_core/src/metadata')
| -rw-r--r-- | mingling_core/src/metadata/description.rs | 47 |
1 files changed, 45 insertions, 2 deletions
diff --git a/mingling_core/src/metadata/description.rs b/mingling_core/src/metadata/description.rs index 3d7b5fd..7bcf0be 100644 --- a/mingling_core/src/metadata/description.rs +++ b/mingling_core/src/metadata/description.rs @@ -1,11 +1,54 @@ -// Doc Not Optimize -/// Provides a description for any Grouped type. +/// A type that provides descriptive information for any [`Grouped`](https://docs.rs/mingling/latest/mingling/trait.Grouped.html) type. +/// +/// `mingling_core::metadata::Description` is a conventional type provided by the Metadata system, +/// used to attach readable descriptive metadata to each Entry in a program. It can be attached to +/// any type that implements the `Metadata` trait, serving as the human-readable description text +/// for that Entry. +/// +/// # Examples +/// +/// Create using the `new` method: +/// +/// ``` +/// # use mingling_core::metadata::Description; +/// let desc = Description::new("This is an example description"); +/// ``` +/// +/// Create using a `From` conversion: +/// +/// ``` +/// # use mingling_core::metadata::Description; +/// let desc: Description = "This is an example description".into(); +/// ``` +/// +/// Create using a `From<String>` conversion: +/// +/// ``` +/// # use mingling_core::metadata::Description; +/// let desc: Description = String::from("This is an example description").into(); +/// ``` pub struct Description { desc: String, } impl Description { /// Creates a new `Description` instance. + /// + /// # Arguments + /// + /// * `desc` - The description text, which can be any type that implements `Into<String>` + /// (such as `&str`, `String`, `&String`, etc.). + /// + /// # Returns + /// + /// Returns a `Description` instance containing the specified description text. + /// + /// # Example + /// + /// ``` + /// # use mingling_core::metadata::Description; + /// let desc = Description::new("This is an example description"); + /// ``` pub fn new<S: Into<String>>(desc: S) -> Self { Self { desc: desc.into() } } |
