From 5aeea111091efbc80d6796c067b586a48930f48e Mon Sep 17 00:00:00 2001 From: 魏曹先生 <1992414357@qq.com> Date: Fri, 14 Aug 2026 03:55:51 +0800 Subject: docs(metadata): expand Description documentation with examples and details --- mingling_core/src/metadata/description.rs | 47 +++++++++++++++++++++++++++++-- 1 file changed, 45 insertions(+), 2 deletions(-) (limited to 'mingling_core/src/metadata') 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` 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` + /// (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>(desc: S) -> Self { Self { desc: desc.into() } } -- cgit