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

part of 'lib.g.dart';

final class _DateDifferenceOptionsFfi extends ffi.Struct {
  external _ResultInt32Void largestUnit;
}

/// See the [Rust documentation for `DateDifferenceOptions`](https://docs.rs/icu/2.2.0/icu/calendar/options/struct.DateDifferenceOptions.html) for more information.
final class DateDifferenceOptions {
  // ignore: public_member_api_docs
  DateDurationUnit? largestUnit;

  // ignore: public_member_api_docs
  DateDifferenceOptions({this.largestUnit});

  // 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
  DateDifferenceOptions._fromFfi(_DateDifferenceOptionsFfi ffi) :
    largestUnit = ffi.largestUnit.isOk ? DateDurationUnit.values[ffi.largestUnit.union.ok] : null;

  // ignore: unused_element
  _DateDifferenceOptionsFfi _toFfi(ffi.Allocator temp) {
    final struct = ffi.Struct.create<_DateDifferenceOptionsFfi>();
    final largestUnit = this.largestUnit;
    struct.largestUnit = largestUnit != null ? _ResultInt32Void.ok(largestUnit.index) : _ResultInt32Void.err();
    return struct;
  }


  @override
  bool operator ==(Object other) =>
      other is DateDifferenceOptions &&
      other.largestUnit == largestUnit;

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

// dart format on
