You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@avro.apache.org by "martin-g (via GitHub)" <gi...@apache.org> on 2026/01/23 13:29:07 UTC
[PR] feat: `RecordField::builder().name()` accepts `Into` [avro-rs]
martin-g opened a new pull request, #429:
URL: https://github.com/apache/avro-rs/pull/429
Issue #419
--
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: dev-unsubscribe@avro.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] feat: `RecordSchema/RecordField::builder().name()` accepts `Into` [avro-rs]
Posted by "Kriskras99 (via GitHub)" <gi...@apache.org>.
Kriskras99 commented on code in PR #429:
URL: https://github.com/apache/avro-rs/pull/429#discussion_r2721549747
##########
avro/src/schema/record/schema.rs:
##########
@@ -42,6 +45,18 @@ pub struct RecordSchema {
pub attributes: BTreeMap<String, Value>,
}
+use record_schema_builder::{IsUnset, SetName, State};
Review Comment:
Let's move these to the top of the file, or replace the import by full paths in the `impl`
##########
avro/src/schema/record/schema.rs:
##########
@@ -42,6 +45,18 @@ pub struct RecordSchema {
pub attributes: BTreeMap<String, Value>,
}
+use record_schema_builder::{IsUnset, SetName, State};
+impl<S: State> RecordSchemaBuilder<S> {
+ /// Try to set a Name from the given string.
+ pub fn try_name(self, name: impl Into<String>) -> AvroResult<RecordSchemaBuilder<SetName<S>>>
+ where
+ <S as State>::Name: IsUnset,
+ {
+ let name = Name::try_from(name.into())?;
+ Ok(self.name(name))
Review Comment:
```suggestion
pub fn try_name<T>(self, name: T) -> Result<RecordSchemaBuilder<SetName<S>>, <T as TryInto<Name>>::Error>
where
<S as State>::Name: IsUnset,
T: TryInto<Name>,
{
let name = name.try_into()?;
Ok(self.name(name))
```
This makes the function more generic and allows users to convert from their own types.
--
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: issues-unsubscribe@avro.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] feat: `RecordSchema/RecordField::builder().name()` accepts `Into` [avro-rs]
Posted by "Kriskras99 (via GitHub)" <gi...@apache.org>.
Kriskras99 commented on code in PR #429:
URL: https://github.com/apache/avro-rs/pull/429#discussion_r2721561745
##########
avro/src/schema/record/schema.rs:
##########
@@ -42,6 +45,18 @@ pub struct RecordSchema {
pub attributes: BTreeMap<String, Value>,
}
+use record_schema_builder::{IsUnset, SetName, State};
Review Comment:
Or move the import inside the `try_name` function
--
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: issues-unsubscribe@avro.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] feat: `RecordSchema/RecordField::builder().name()` accepts `Into` [avro-rs]
Posted by "martin-g (via GitHub)" <gi...@apache.org>.
martin-g merged PR #429:
URL: https://github.com/apache/avro-rs/pull/429
--
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: dev-unsubscribe@avro.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org