If we change the signature from
pub fn escape_byte_string<B>(bytes: B) -> String
where
B: AsRef<[u8]>,
to
pub fn escape_byte_string<B>(bytes: B) -> String
where
B: IntoIterator<Item=u8>,
then we can pass more types to the function, e.g. VecDeque<u8>.
The implementation would not change much because we create an iterator anyway. Current implementation:
let bytes = bytes.as_ref();
bytes
.iter()
//...
If we change the signature from
to
then we can pass more types to the function, e.g.
VecDeque<u8>.The implementation would not change much because we create an iterator anyway. Current implementation: