Closed satoren closed 2 months ago
The changes involve the removal of the unwrap_tuple
function from the Yex.Nif.Util
module and the simplification of return handling in various modules, including Yex.Array
, Yex.Map
, Yex.Text
, Yex.XmlElement
, and Yex.XmlFragment
. New functions for XML manipulation were introduced, and resource management was refactored in the Rust components, transitioning from resource wrappers to shared types.
Files | Change Summary |
---|---|
lib/nif.ex , lib/shared_type/array.ex , lib/shared_type/map.ex , lib/shared_type/text.ex , lib/shared_type/xml_element.ex , lib/shared_type/xml_fragment.ex |
Removed unwrap_tuple function and simplified return handling by eliminating calls to unwrap_tuple and unwrap_ok_tuple . Introduced new functions for XML manipulation. |
native/yex/Cargo.toml |
Added dependencies: flexbuffers and serde . |
native/yex/src/array.rs , native/yex/src/map.rs , native/yex/src/text.rs , native/yex/src/xml.rs |
Refactored resource management by replacing resource wrappers with shared types (NifSharedType ). |
native/yex/src/lib.rs |
Introduced a new shared_type module for better organization. |
native/yex/src/shared_type.rs |
Defined NifSharedType<T> for managing shared types in Rustler NIF context. |
test/shared_type/array_test.exs , test/shared_type/map_test.exs , test/shared_type/text_test.exs , test/shared_type/xml_element_test.exs , test/shared_type/xml_fragment_test.exs |
Added new test cases to enhance coverage for array, map, text, and XML functionalities. |
sequenceDiagram
participant Client
participant Yex.Array
participant Yex.Map
participant Yex.Text
participant Yex.XmlElement
participant Yex.XmlFragment
Client->>Yex.Array: Call array_delete_range()
Yex.Array-->>Client: Return result directly
Client->>Yex.Map: Call set()
Yex.Map-->>Client: Return result directly
Client->>Yex.Text: Call delete()
Yex.Text-->>Client: Return result directly
Client->>Yex.XmlElement: Call insert_after()
Yex.XmlElement-->>Client: Return :ok or :error
Client->>Yex.XmlFragment: Call insert_after()
Yex.XmlFragment-->>Client: Return :ok or :error
🐰 "In the garden, changes bloom,
With functions new, there's more room.
No more tuples to unwrap,
Just direct calls, a simpler map.
Hopping through code, I cheer with glee,
For cleaner paths, oh joy for me!" 🐇
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?
Summary by CodeRabbit
New Features
insert_after
functions inYex.XmlElement
andYex.XmlFragment
modules for enhanced XML manipulation.Bug Fixes
Yex.Array
,Yex.Map
,Yex.Text
, and XML modules to improve error management and output consistency.Tests
Array
,Map
,Text
,XmlElement
, andXmlFragment
modules to improve coverage and validate new functionalities.Chores
Cargo.toml
to includeflexbuffers
andserde
for improved serialization capabilities.