Creates a new [`PackageDescription`] from a string slice. Trims leading and trailing whitespace. Replaces any new lines and tabs with a space. Replaces any consecutive spaces with a single space.
(value: &str)
| 102 | /// # } |
| 103 | /// ``` |
| 104 | #[derive(Clone, Debug, Deserialize, Eq, PartialEq, Serialize)] |
| 105 | pub struct PackageDescription(String); |
| 106 | |
| 107 | impl PackageDescription { |
| 108 | /// Create a new `PackageDescription` from a given `String`. |
| 109 | pub fn new(description: &str) -> Self { |
| 110 | Self::from(description) |
| 111 | } |
| 112 | } |
| 113 | |
| 114 | impl Default for PackageDescription { |
| 115 | /// Returns the default [`PackageDescription`]. |
| 116 | /// |
| 117 | /// Following the default for [`String`], this returns a [`PackageDescription`] wrapping an |
| 118 | /// empty string. |
| 119 | fn default() -> Self { |
| 120 | Self::new("") |
| 121 | } |
| 122 | } |
nothing calls this directly
no outgoing calls
no test coverage detected