// generated by diplomat-tool
// dart format off

part of 'lib.g.dart';

final class _CodePointRangeIteratorResultFfi extends ffi.Struct {
  @ffi.Uint32()
  external Rune start;
  @ffi.Uint32()
  external Rune end;
  @ffi.Bool()
  external bool done;
}

/// Result of a single iteration of [CodePointRangeIterator].
/// Logically can be considered to be an `Option<RangeInclusive<DiplomatChar>>`,
///
/// `start` and `end` represent an inclusive range of code points `[start, end]`,
/// and `done` will be true if the iterator has already finished. The last contentful
/// iteration will NOT produce a range `done=true`, in other words `start` and `end` are useful
/// values if and only if `done=false`.
final class CodePointRangeIteratorResult {
  // ignore: public_member_api_docs
  final Rune start;
  // ignore: public_member_api_docs
  final Rune end;
  // ignore: public_member_api_docs
  final bool done;

  // This struct contains borrowed fields, so this takes in a list of
  // "edges" corresponding to where each lifetime's data may have been borrowed from
  // and passes it down to individual fields containing the borrow.
  // This method does not attempt to handle any dependencies between lifetimes, the caller
  // should handle this when constructing edge arrays.
  // ignore: unused_element
  CodePointRangeIteratorResult._fromFfi(_CodePointRangeIteratorResultFfi ffi) :
    start = ffi.start,
    end = ffi.end,
    done = ffi.done;

  // ignore: unused_element
  _CodePointRangeIteratorResultFfi _toFfi(ffi.Allocator temp) {
    final struct = ffi.Struct.create<_CodePointRangeIteratorResultFfi>();
    struct.start = start;
    struct.end = end;
    struct.done = done;
    return struct;
  }


  @override
  bool operator ==(Object other) =>
      other is CodePointRangeIteratorResult &&
      other.start == start &&
      other.end == end &&
      other.done == done;

  @override
  int get hashCode => Object.hashAll([
        start,
        end,
        done,
      ]);
}

// dart format on
