   /// advances the reader by one field so that the next field can be read.
   ///
   /// - Parameter index: The index of the field that shall be discarded
-  func discardField(index: Int) {
+  mutating func discardField(index: Int) {
     advanceAndValidateIndex(index)
     reader.discardField()
   }
 
-  deinit {
+  fileprivate mutating func finalize() {
     // Discard all fields that have not been read
     while nextIndex < numFields {
       discardField(index: nextIndex)

  ///   - objectType: The type as which this field should be read
  ///   - index: The index of this field
  /// - Returns: The decoded field
  func readField<FieldType: ByteTreeObjectDecodable>(
    _ objectType: FieldType.Type, index: Int
  ) -> FieldType {
    advanceAndValidateIndex(index)

    let numFields = readFieldLength()
    var objectReader = ByteTreeObjectReader(reader: self,
                                            numFields: numFields)
    defer {
      objectReader.finalize()
    }
    return T.read(from: &objectReader, numFields: numFields, userInfo: userInfo)
  }

