0

I'm trying to get the regex crate to work on a pallet to check for an extrinsic input, but I can't get node to compile. Although I don't have the specific error to show, the question is if it is possible to include this crate in a pallet or how you can know which crates are compatible in a pallet.

4
  • What error do you get? Is it a no_std issue?
    – Simson
    Nov 8, 2022 at 10:56
  • Can you post compilation error? and also your Cargo.toml code where you are adding this crate? Nov 8, 2022 at 11:24
  • yes, I have to set it up again, that's why I was asking if it was possible without providing the error, but I'll attach it asap
    – andresvsm
    Nov 8, 2022 at 11:34
  • 1
    You can not use regex in pallet btw. Please see my answer. I hope this helps. Nov 8, 2022 at 11:39

1 Answer 1

3

All pallet dependencies should support no_std. regex does not support no_std.

You can use safe-regex as an alternative or any other dependency which supports no_std.

[dependencies]
safe-regex = "0.2.5"

Add this in your Cargo.toml and it would work.

2
  • Thanks! I'll test it out. Where can I see wether a crate supports no_std or not? Should it have #![no_std] in the source?
    – andresvsm
    Nov 8, 2022 at 11:48
  • I think so. safe-regex explicitly has mentioned in their document crates.io/crates/safe-regex Please accept the answer if this helps you. Nov 8, 2022 at 11:52

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.