Overview
This crate provides custom Serde utilities focused on parsing check or serial numbers into an optional u64. An empty string is interpreted as None, while numeric strings and integral values are parsed as Some(u64).
Features
- Optional Parsing: Attempts to parse an incoming field as a
u64, returningNoneif the field is empty. - Robust Error Handling: Produces structured Serde errors for malformed input, ensuring safe deserialization in production.
Usage
Add the following to your Cargo.toml:
[]
= "0.1.0"
= "1.0"
= "1.0"
Import and apply the custom deserializer:
use Deserialize;
use parse_check_or_serial_number_opt;
Example
Testing
Run tests using:
The comprehensive test suite verifies empty string handling, numeric string conversion, and numeric literal conversion, ensuring proper adherence to expected deserialization behavior.
Contributing
- Fork the repository
- Create a feature branch
- Commit your changes
- Open a pull request
Issues and pull requests are welcomed to improve functionality, fix bugs, or enhance documentation.
© 2025 tktax-serde contributors. Licensed under the Apache-2.0 License.