Skip to content

escape_byte_string could accept B: IntoIterator<Item=u8> #612

@jakoschiko

Description

@jakoschiko

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()
    //...

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    Status

    No status

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions