1
0
mirror of https://github.com/trezor/trezor-firmware.git synced 2025-01-26 07:11:25 +00:00

refactor(core/rust): disallow creating byte buffers from &str

This commit is contained in:
matejcik 2022-03-15 12:34:44 +01:00 committed by matejcik
parent 32c3320f07
commit 8dd7a22f8b

View File

@ -24,7 +24,7 @@ pub struct Buffer {
impl Buffer {
pub fn empty() -> Self {
Self::from("")
Self::from(b"")
}
}
@ -70,8 +70,8 @@ impl From<&'static [u8]> for Buffer {
}
}
impl From<&'static str> for Buffer {
fn from(val: &'static str) -> Self {
impl<const N: usize> From<&'static [u8; N]> for Buffer {
fn from(val: &'static [u8; N]) -> Self {
Buffer {
ptr: val.as_ptr(),
len: val.len(),