MCPcopy Create free account
hub / github.com/archlinux/alpm / from

Method from

alpm-types/src/pkg.rs:104–119  ·  view source on GitHub ↗

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)

Source from the content-addressed store, hash-verified

102/// # }
103/// ```
104#[derive(Clone, Debug, Deserialize, Eq, PartialEq, Serialize)]
105pub struct PackageDescription(String);
106
107impl PackageDescription {
108 /// Create a new `PackageDescription` from a given `String`.
109 pub fn new(description: &str) -> Self {
110 Self::from(description)
111 }
112}
113
114impl 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}

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected