This is an automated email from the ASF dual-hosted git repository.

mgrigorov pushed a commit to branch 419-recordfield-name-into
in repository https://gitbox.apache.org/repos/asf/avro-rs.git

commit ae537f4f3705412ebce9a88c9494f53e7a522d11
Author: Martin Tzvetanov Grigorov <[email protected]>
AuthorDate: Fri Jan 23 15:26:20 2026 +0200

    feat: `RecordField::builder().name()` accepts `Into<String>`
    
    Issue #419
---
 avro/src/schema/record/field.rs | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)

diff --git a/avro/src/schema/record/field.rs b/avro/src/schema/record/field.rs
index 9a42310..6e70cba 100644
--- a/avro/src/schema/record/field.rs
+++ b/avro/src/schema/record/field.rs
@@ -34,6 +34,7 @@ use strum_macros::EnumString;
 #[derive(bon::Builder, Clone, Debug, PartialEq)]
 pub struct RecordField {
     /// Name of the field.
+    #[builder(into)]
     pub name: String,
     /// Documentation of the field.
     #[builder(default)]
@@ -265,4 +266,21 @@ mod tests {
         assert!(!non_nullable_record_field.is_nullable());
         Ok(())
     }
+
+    #[test]
+    fn avro_rs_419_name_into() -> TestResult {
+        let field = RecordField::builder()
+            .name("str_slice")
+            .schema(Schema::Boolean)
+            .build();
+        assert_eq!(field.name, "str_slice");
+
+        let field = RecordField::builder()
+            .name("String".to_string())
+            .schema(Schema::Boolean)
+            .build();
+        assert_eq!(field.name, "String");
+
+        Ok(())
+    }
 }

Reply via email to