Skip to content

Commit 5aa5c3d

Browse files
PatrickNortontormol
authored andcommitted
Added From<AsciiChar> for AsciiString
1 parent ab36f52 commit 5aa5c3d

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

src/ascii_string.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -468,6 +468,13 @@ impl From<Vec<AsciiChar>> for AsciiString {
468468
}
469469
}
470470

471+
impl From<AsciiChar> for AsciiString {
472+
#[inline]
473+
fn from(ch: AsciiChar) -> Self {
474+
AsciiString {vec: vec![ch]}
475+
}
476+
}
477+
471478
impl Into<Vec<u8>> for AsciiString {
472479
fn into(mut self) -> Vec<u8> {
473480
// SAFETY: All ascii bytes are valid `u8`, as we are `repr(u8)`.

0 commit comments

Comments
 (0)