pkstrings: Don't consume PKString when converting to String

Signed-off-by: Maxime “pep” Buquet <pep@bouah.net>
This commit is contained in:
Maxime “pep” Buquet 2021-11-15 16:14:08 +01:00
parent d2df9f1097
commit 99043c9dd2
Signed by: pep
GPG key ID: DEDA74AEECA9D0F2

View file

@ -202,13 +202,13 @@ impl From<PKString> for Vec<u8> {
}
}
impl From<PKString> for String {
fn from(pkstr: PKString) -> String {
impl From<&PKString> for String {
fn from(pkstr: &PKString) -> String {
let placeholder = '_';
let mut buf = String::new();
for ord in pkstr.0 {
match hextochr(ord) {
for ord in &pkstr.0 {
match hextochr(*ord) {
Some(chr) => buf.push(chr),
None => buf.push(placeholder.clone()),
}