(
#[builder(start_fn)] reader: R,
/// The schema the written data needs to be adapted to.
///
/// This is currently not compatible with [`ReaderDeser`] and will panic d
| 68 | /// **NOTE** The avro header is going to be read automatically upon creation of the `Reader`. |
| 69 | #[builder(finish_fn = build)] |
| 70 | pub fn builder( |
| 71 | #[builder(start_fn)] reader: R, |
| 72 | /// The schema the written data needs to be adapted to. |
| 73 | /// |
| 74 | /// This is currently not compatible with [`ReaderDeser`] and will panic during reading if the |
| 75 | /// writer schema is not the same as the reader schema. |
| 76 | reader_schema: Option<&'a Schema>, |
| 77 | schemata: Option<Vec<&'a Schema>>, |
| 78 | #[builder(default = is_human_readable())] human_readable: bool, |
| 79 | ) -> AvroResult<Reader<'a, R>> { |
| 80 | let schemata = |
| 81 | schemata.unwrap_or_else(|| reader_schema.map(|rs| vec![rs]).unwrap_or_default()); |
| 82 | |
| 83 | let block = Block::new(reader, schemata, human_readable)?; |
| 84 | let mut reader = Reader { |
| 85 | block, |
| 86 | reader_schema, |
| 87 | errored: false, |
| 88 | should_resolve_schema: false, |
| 89 | }; |
| 90 | // Check if the reader and writer schemas disagree. |
| 91 | reader.should_resolve_schema = |
| 92 | reader_schema.is_some_and(|reader_schema| reader.writer_schema() != reader_schema); |
| 93 | Ok(reader) |
| 94 | } |
| 95 | |
| 96 | /// Get a reference to the writer `Schema`. |
| 97 | #[inline] |
nothing calls this directly
no test coverage detected