Conversation
1ab9e83 to
4f4acd3
Compare
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #837 +/- ##
============================================
+ Coverage 79.05% 80.21% +1.15%
Complexity 615 615
============================================
Files 90 93 +3
Lines 9649 10265 +616
Branches 1047 1047
============================================
+ Hits 7628 8234 +606
- Misses 1781 1791 +10
Partials 240 240 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Pull request overview
This PR extends the Rust bindings for GraphAr to include edge metadata (EdgeInfo) and adjacency list metadata, completing the symmetry with the existing vertex metadata support. It also introduces a crate-wide error type to improve ergonomics and error propagation throughout the API.
Changes:
- Introduces
ErrorandResulttypes for consistent error handling across the crate - Adds Rust bindings for
EdgeInfoandAdjacentListwith builder pattern support - Refactors existing APIs (
VertexInfo, property types) to use the new error types and improve consistency
Reviewed changes
Copilot reviewed 11 out of 11 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| rust/src/error.rs | New error module with Error enum and Result type alias for crate-wide error handling |
| rust/src/lib.rs | Exports error types and adds UTF-8 path validation helper |
| rust/src/ffi.rs | Extends FFI bridge with EdgeInfo, AdjacentList, and AdjListType bindings |
| rust/include/graphar_rs.h | C++ header declarations for edge info and adjacency list APIs |
| rust/src/graphar_rs.cc | C++ implementation with validation for create_edge_info and related functions |
| rust/src/info/mod.rs | Adds and re-exports new adjacency list and edge info modules |
| rust/src/info/adjacent_list.rs | New wrapper for adjacency list metadata with comprehensive tests |
| rust/src/info/edge_info.rs | New wrapper for edge metadata with builder pattern and extensive tests |
| rust/src/info/vertex_info.rs | Updates builder API and error handling; removes Unix-specific path handling in favor of UTF-8 requirement |
| rust/src/info/version.rs | Updates to use crate-wide Result type |
| rust/src/property.rs | Refactors to remove DerefMut and add explicit borrowing helpers; tightens API constraints to use AsRef<str> |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Reason for this PR
#832 implement
EdgeInfobinding for RustWhat changes are included in this PR?
This PR extends the Rust bindings to cover GraphAr edge metadata (
EdgeInfo) and adjacency list metadata, and introduces a crate-wide error type to improve ergonomics and error propagation.(following details are generated by AI )
rust/include/graphar_rs.hcreate_edge_info,edge_info_save,edge_info_dumpnew_adjacent_list_vec,push_adjacent_listgraphar::SharedAdjacentListand includes<cstddef>for completeness.rust/src/error.rs(new)crate::Errorandcrate::Result<T>:Error::Cxx(cxx::Exception)for propagated C++ exceptionsError::NonUtf8Path(PathBuf)for rejecting non-UTF8 filesystem pathsrust/src/lib.rspub mod errorand re-exportsError/Resultat the crate root.path_to_utf8_str(&Path) -> crate::Result<&str>used bysaveAPIs.cxx_string_to_stringhelper in favor of.to_string().rust/src/ffi.rsSharedAdjacentListas an opaquecxx::ExternType.cxx::bridgewith:AdjListType(GraphArAdjListTypebit flags)AdjacentListbindings (CreateAdjacentList, getters)AdjacentListVectorhelpers (new_adjacent_list_vec,push_adjacent_list)EdgeInfobindings (getters, property group accessors,create_edge_info,save,dump)rust/src/graphar_rs.cccreate_edge_infowith explicit validation and null checks.AdjacentListVectorconstructor/push helpers exposed to Rust viacxx.edge_info_saveandedge_info_dumpwith error propagation via exceptions.rust/src/info/mod.rsadjacent_list,edge_info.AdjListTypeAdjacentList,AdjacentListVectorEdgeInfo,EdgeInfoBuilderrust/src/info/adjacent_list.rs(new)AdjacentList::new, getters (ty,file_type,prefix)AdjacentListVectorwrapper withnew,push, and borrowing helpersrust/src/info/edge_info.rs(new)EdgeInfogetters (types, chunk sizes, prefix, directed, version)has_adjacent_list_type,adjacent_list)save/dumpEdgeInfoBuilderto reduce constructor argument noise.dump/savebehavior and non-UTF8 path rejectionrust/src/info/version.rsInfoVersion::newto returncrate::Result<Self>to align with the new crate-wide error type.rust/src/info/vertex_info.rsVertexInfo::builder(type, chunk_size)no longer takesproperty_groupsas a required argument.push_property_groupandproperty_groups.AsRef<[u8]>toAsRef<str>for type/prefix/property name inputs.saveto require a UTF-8 path (returnsError::NonUtf8Pathfor non-UTF8 paths on Unix).rust/src/property.rsPropertyVecandPropertyGroupVectorwrappers:DerefMutusage and introduces explicit borrowing helpers (as_ref,pin_mut) for mutating C++ vectors.PropertyGroup::newprefix input from bytes toAsRef<str>.Are these changes tested?
Yes
Are there any user-facing changes?
Yes