Skip to content

Conversation

kailan
Copy link

@kailan kailan commented Aug 13, 2025

I need to load glob patterns from a configuration file but got an error as there is no Deserialize implementation for Pattern.

This change adds a serde feature to the crate that enables an implementation of serde::Serialize and serde::Deserialize on the Pattern struct.

Closes #136.

@tgross35
Copy link
Contributor

I don't think we want this functionality: the usecase is niche, and we may not have the internal &str available in a future version. For the purpose of loading config, you can get what you need with serde::deserialize_with, which also lets you set the flags you want.

regex::Regex similarly does not provide serde traits.

@tgross35
Copy link
Contributor

With the above in mind, I am going to close this and the issue: it is reasonably straightforward to reconstruct a glob from the deserialized string.

Thank you for the submission!

@kailan
Copy link
Author

kailan commented Aug 14, 2025

Yep, that makes sense. Thank you for your review!

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.

Serialize and Deserialize with serde
2 participants