WARNING: THIS SITE IS A MIRROR OF GITHUB.COM / IT CANNOT LOGIN OR REGISTER ACCOUNTS / THE CONTENTS ARE PROVIDED AS-IS / THIS SITE ASSUMES NO RESPONSIBILITY FOR ANY DISPLAYED CONTENT OR LINKS / IF YOU FOUND SOMETHING MAY NOT GOOD FOR EVERYONE, CONTACT ADMIN AT ilovescratch@foxmail.com
Skip to content

std::error::Error implementation for hex::Error #258

@Velnbur

Description

@Velnbur

It seems that elements::hex::Error is missing std::error::Error implementation, which makes it difficult to work with dynamic-error crates (like eyre or anyhow), as there default ::from method requires that.

For example,

let bytes_res = Vec::<u8>::from_hex(&raw_tx).map_err(eyre::Report::from);

doesn't compile, as eyre::Report::from requires T: std::error::Error, but:

let bytes_res = Vec::<u8>::from_hex(&raw_tx).map_err(|e| eyre::eyre!(e));

works, as it does some black-magic under the hood with the value. So still from implementation is preferable

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