Thanks to visit codestin.com
Credit goes to Github.com

Skip to content

Conversation

@rukai
Copy link

@rukai rukai commented Dec 22, 2025

I saw the policy asking to avoid adding new crates.
Since this is adding support for more types in an already supported crate, I think its fine?

Implementation is taken from the smolstr_0_3 module.

The unwrap in deserialize looks a bit sus, but its the same behavior as the other types which just panic when they don't have enough room.

&self,
_deserializer: &mut D,
) -> Result<ArrayString<CAP>, D::Error> {
Ok(ArrayString::from(self.as_str()).unwrap())
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd prefer to return an error instead of unwrapping here. See the docs for fail! for an example of how to write a rancor-compatible error.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It doesnt look like I can do that without changing the trait definition?
image
image

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.

2 participants