@@ -302,25 +302,42 @@ impl Default for GeneratorBuilder {
302302 }
303303}
304304
305- #[ derive( PartialEq , Debug , Clone , Copy ) ]
305+ #[ derive( PartialEq , Debug , Clone , Copy , Default ) ]
306306#[ cfg_attr( feature = "build-cli" , derive( clap:: ValueEnum ) ) ]
307- /// How to implement [`AvroSchema`].
307+ /// How to implement [`AvroSchema`][avsc].
308+ ///
309+ /// [avsc]: apache_avro::schema::AvroSchema
308310pub enum ImplementAvroSchema {
309- /// Use the [`AvroSchema`] derive.
311+ /// Use the [`AvroSchema`][derive] derive.
312+ ///
313+ /// This might result in a slightly different schema, as names can have different
314+ /// capitalisation.
310315 ///
311- /// This might result in a slightly different schema, as names can have different capitalisation.
316+ /// [derive]: derive@apache_avro::AvroSchema
312317 Derive ,
318+
313319 /// Copy the schema used at build time.
314320 ///
315- /// This will use the [canonical form](Schema::canonical_form) to create an exact (canonical) match.
321+ /// This will use the [canonical form](Schema::canonical_form) to create an exact
322+ /// (canonical) match. Implementations generated by this functionality won't use the
323+ /// [`AvroSchemaComponent`][avsc-compo] implementation of subtypes.
316324 ///
317- /// Implementations generated by this functionality won't use the [`AvroSchemaComponent`] implementation
318- /// of subtypes.
325+ /// [avsc-compo]: apache_avro::schema::derive::AvroSchemaComponent
319326 CopyBuildSchema ,
320- /// Do not implement or derive [`AvroSchema`].
327+
328+ /// Do not implement or derive [`AvroSchema`][avsc].
329+ ///
330+ /// [avsc]: apache_avro::schema::AvroSchema
331+ #[ default]
321332 None ,
322333}
323334
335+ impl std:: fmt:: Display for ImplementAvroSchema {
336+ fn fmt ( & self , f : & mut std:: fmt:: Formatter ) -> std:: fmt:: Result {
337+ write ! ( f, "{self:?}" )
338+ }
339+ }
340+
324341impl GeneratorBuilder {
325342 /// Creates a new [`GeneratorBuilder`](GeneratorBuilder).
326343 pub fn new ( ) -> GeneratorBuilder {
@@ -364,12 +381,14 @@ impl GeneratorBuilder {
364381 self
365382 }
366383
367- /// Add an implementation of [`AvroSchema`].
384+ /// Add an implementation of [`AvroSchema`][avsc] .
368385 ///
369386 /// This implementation can either use a derive or copy the schema used to generate the type.
370387 /// See [`ImplementAvroSchema`] for more information.
371388 ///
372389 /// Applies to record structs.
390+ ///
391+ /// [avsc]: apache_avro::schema::AvroSchema
373392 pub fn implement_avro_schema ( mut self , impl_schemas : ImplementAvroSchema ) -> GeneratorBuilder {
374393 self . impl_schemas = impl_schemas;
375394 self
0 commit comments