Skip to content

panic when getting an index that has none value #783

Answered by marirs
marirs asked this question in Q&A

You must be logged in to vote

Sorry - I think I got it done myself.
Instead of using .index
I used the .get(1).map_or("", |m|m.as_str())

This helped me to put a default value of "" if the capture did not have a value.

Thanks !

Replies: 1 comment 2 replies

You must be logged in to vote
2 replies
@BurntSushi

@marirs

Answer selected by marirs
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants