Skip to content

Conversation

@willemneal
Copy link
Member

Goal

Allow the use of in no_std environments, particularly in smart contracts.

Solution

The main culprit preventing the no_std was the use of String and format.

To get around this I added a std feature and arrayvec which has ArrayString which allows allocating a String on the stack.

Future work

One area that I would like to revisit is Errors. In my experience it's better for there to be more specific cases rather than general ones that use strings. This way callers can match against the error rather then inspect the inner string.

# Goal
Allow the use of in no_std environments, particularly in smart contracts.

# Solution
The main culprit preventing the no_std was the use of `String` and `format`.

To get around this I added a `std` feature and `arrayvec` which has `ArrayString` which allows allocating a `String` on the stack.

# Future work

One area that I would like to revisit is Errors. In my experience it's better for there to be more specific cases rather than general ones that use strings. This way callers can match against the error rather then inspect the inner string.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant