Skip to content

Please clarify why ToHex is deprecated #26

@Pzixel

Description

@Pzixel

I wanted to thank you for such a wonderful crate.

It is a bit confusing why the ToHex trait is deprecated.
My use case for the crate includes creating a lot of hexed representations for the byte vectors. And making an allocation each time isn't ideal.
Crates like arrayvec that provide an array-backed strings are ideal for such workloads, however the ToHexExt trait unlike ToHex doesn't allow collecing in there.

So i wonder what would you suggest to do in this case. Is it better to just use the ToHex implementation and ignore the obsolete warning, in which case maybe it should not be obsolete? Or are there any plans of extending the ToHexExt trait to work in cases where alloc is undesirable or completely unavailable?

The closest API I've seen was decode_to_slice/encode_to_slice but it's a bit awkward to use because you need to track the length of written characters. If there was a way to return an array-backed string instead of std::String without manually juggling arrays and indices it would be a great addition to the lib.

I can add a PR that adds a smallvec impl (gated behind the feature) if you feel like it fits the library.

Sorry for such an abrupt issue.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions