Tidy PyToBytes into a helper; document data models and attachments behavior#87
Merged
Merged
Conversation
…s and attachments behavior - #29: replace the single-use PyToBytes trait (implemented only for Py<PyAny>, called once) with a plain private payload_to_bytes helper. Same logic: bytes used as-is, str decoded as UTF-8, otherwise TypeError. - #53: document that PyMail.attachments holds every MIME-tree node (text parts and multipart container nodes with empty content), not just files. - #54: add module doc-comments describing the PyO3-free core (mail_parser) vs the PyO3 binding layer (fast_mail_parser) and why they are separate. No public behavior or API change. Signed-off-by: yuriyryabikov <22548029+kurok@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Three non-breaking tidy/documentation changes. No public behavior or API change; the full test suite passes unchanged.
Changes
PyToBytestrait (implemented only forPy<PyAny>, called once inparse_email) with a plain privatepayload_to_bytes(&Py<PyAny>, Python<'_>)helper. Identical logic:bytesused as-is,strdecoded as its UTF-8 bytes, any other type raisesTypeError.PyMail.attachmentscontains every node of the MIME tree -- text parts and the multipart container nodes themselves (containers have emptycontent) -- not just file attachments. Documents existing behavior; nothing changed.src/mail_parser.rsis the PyO3-free core (Mail/Attachment, independently testable) andsrc/fast_mail_parser.rsis the PyO3 binding layer (PyMail/PyAttachment). Notes why the split exists (keeps parsing decoupled from the Python bindings).Verification
cargo fmt --all -- --checkpassescargo clippy --all-targets -- -D warnings -W clippy::cast_possible_truncationcleanpytest -q --ignore tests/benchmark tests: 91 passedCloses #29
Closes #53
Closes #54