diff options
Diffstat (limited to 'mingling_core/src')
| -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() } } |
