Skip to content

bytes!() could be more versatil #6556

Closed
@Kimundi

Description

@Kimundi

At the moment, bytes!() just converts a string literal into a &[u8].

However, to be even more useful for low level stuff it could accept a list of anything reasonably convertible to a list of u8s, like strings, chars in ascii range, explicit u8s etc.

Then you could do for example:

  • bytes!("foo", 0) - vector of the bytes in "foo" and a null terminator.
  • bytes!('a', 42, 'b', 98, 'c', 255) - some kind of binary data format.
  • bytes!(" ", ' ', 32) - a vector of three 32u8.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions