blackmwk commented on code in PR #3044:
URL: https://github.com/apache/iceberg-rust/pull/3044#discussion_r3870603459


##########
crates/property-macro/README.md:
##########
@@ -17,7 +17,7 @@
   under the License.
 -->
 
-# Iceberg property derive macro
+# Iceberg property macros

Review Comment:
   Done. The README now introduces `#[derive(Properties)]` and 
`properties_view!` in separate top-level sections, with their APIs and use 
cases documented independently.



##########
crates/property-macro/README.md:
##########
@@ -211,6 +211,53 @@ fn main() -> iceberg::Result<()> {
 }
 ```
 
+## Borrowed property views
+
+`properties_view!` defines a lightweight borrowed view over a flat property
+map. Its struct-shaped fields are property declarations rather than stored
+fields. Constructing the view does not parse anything; each generated getter
+parses and returns only its declared property. Missing properties use their
+annotated defaults, while invalid configured values return an error from the
+corresponding getter.
+
+```rust
+use std::collections::HashMap;
+
+use iceberg_property_macro::properties_view;
+
+properties_view! {
+    #[derive(Debug)]
+    pub struct WriteProperties {
+        /// Number of times to retry a commit.
+        #[property(key = "commit.retry.num-retries", default = 4)]
+        pub commit_num_retries: usize,

Review Comment:
   Done. The view example and surrounding text now explain that visibility 
modifiers control generated getter visibility; the declarations are not stored 
fields.



##########
crates/property-macro/tests/properties.rs:
##########
@@ -260,6 +261,126 @@ fn 
custom_single_value_parser_wraps_present_optional_values() {
     assert!(format!("{error}").contains("property: optional-location"));
 }
 
+properties_view! {

Review Comment:
   Done. I added a dedicated `properties_view!` trybuild suite with nine 
compile-fail cases covering shared annotation validation plus view-specific 
generic and tuple declarations.



##########
crates/property-macro/README.md:
##########
@@ -211,6 +211,53 @@ fn main() -> iceberg::Result<()> {
 }
 ```
 
+## Borrowed property views
+
+`properties_view!` defines a lightweight borrowed view over a flat property
+map. Its struct-shaped fields are property declarations rather than stored
+fields. Constructing the view does not parse anything; each generated getter
+parses and returns only its declared property. Missing properties use their
+annotated defaults, while invalid configured values return an error from the
+corresponding getter.
+
+```rust
+use std::collections::HashMap;
+
+use iceberg_property_macro::properties_view;
+
+properties_view! {
+    #[derive(Debug)]
+    pub struct WriteProperties {
+        /// Number of times to retry a commit.
+        #[property(key = "commit.retry.num-retries", default = 4)]
+        pub commit_num_retries: usize,
+
+        /// Optional base directory for metadata files.
+        #[property(key = "write.metadata.path", default = None)]
+        pub write_metadata_path: Option<String>,

Review Comment:
   Done. The example now declares a private `raw_write_metadata_path: 
Option<String>` getter and exposes a custom public `write_metadata_path()` that 
falls back to `<table path>/metadata`.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to