-
Notifications
You must be signed in to change notification settings - Fork 38
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Implement Send for Document #123
Comments
You're right for a single document object in isolation, but I worry. Consider a program that builds a document, then extracts some nodes from it for manipulation, then hands off the document to another thread (via I had tried my hand at a |
If you don't need mutability, I could imagine extending the read-only treatment for nodes, which added a thread-safe |
Correct. And that's exactly the distinction between
Agreed. But
Agreed. Native
My use case is basically evaluating XPATHs, so no mutation. And yeah, I think |
Actually no, I don't think that is the difference. A For So yes, let root: RoNode = doc.get_root_readonly().unwrap(); |
For the time being, I'm keeping both Rust and Lua validators. I had to switch caps_cache to store Strings instead of parsed documents, because: 1) I'm ditching unmaintained sxd_document and sxd_xpath in favor of libxml, 2) I'm working on Python bindings for which I need VirtLint struct to satisfy Send trait and neither sxd_document's Document, nor libxml's Document have that [1]. To avoid random test failures, warnings obtained via VirtLint::warnings() are now sorted (readdir() and Lua and stuff) which means that warning() method now has to take a mutable reference to VirtLint object. 1: KWARC/rust-libxml#123 Signed-off-by: Michal Privoznik <[email protected]>
Document is declared as follows:
Now, looking into libxml sources, neither
struct _xmlDoc
norstruct _xmlNode
contain any thread local data. Therefore, it should be possible for theDocument
to have Send trait.The text was updated successfully, but these errors were encountered: