We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
ComponentPart::encode()
1 parent 6606aa7 commit a2d5350Copy full SHA for a2d5350
src/dist/component/components.rs
@@ -198,13 +198,16 @@ impl ComponentPart {
198
const PATH_SEP_MAIN: &str = std::path::MAIN_SEPARATOR_STR;
199
200
pub(crate) fn encode(&self) -> String {
201
+ let mut buf = self.kind.to_string();
202
+ buf.push(':');
203
// Lossy conversion is safe here because we assume that `path` comes from
204
// `ComponentPart::decode()`, i.e. from calling `Path::from()` on a `&str`.
205
let mut path = self.path.to_string_lossy();
206
if Self::PATH_SEP_MAIN != Self::PATH_SEP_MANIFEST {
207
path = Cow::Owned(path.replace(Self::PATH_SEP_MAIN, Self::PATH_SEP_MANIFEST));
208
};
- format!("{}:{path}", self.kind)
209
+ buf.push_str(&path);
210
+ buf
211
}
212
213
pub(crate) fn decode(line: &str) -> Option<Self> {
0 commit comments