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

part of 'lib.g.dart';

final class _DateFromFieldsOptionsFfi extends ffi.Struct {
  external _ResultInt32Void overflow;
  external _ResultInt32Void missingFieldsStrategy;
}

/// See the [Rust documentation for `DateFromFieldsOptions`](https://docs.rs/icu/2.2.0/icu/calendar/options/struct.DateFromFieldsOptions.html) for more information.
final class DateFromFieldsOptions {
  // ignore: public_member_api_docs
  DateOverflow? overflow;
  // ignore: public_member_api_docs
  DateMissingFieldsStrategy? missingFieldsStrategy;

  // ignore: public_member_api_docs
  DateFromFieldsOptions({this.overflow, this.missingFieldsStrategy});

  // 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
  DateFromFieldsOptions._fromFfi(_DateFromFieldsOptionsFfi ffi) :
    overflow = ffi.overflow.isOk ? DateOverflow.values[ffi.overflow.union.ok] : null,
    missingFieldsStrategy = ffi.missingFieldsStrategy.isOk ? DateMissingFieldsStrategy.values[ffi.missingFieldsStrategy.union.ok] : null;

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


  @override
  bool operator ==(Object other) =>
      other is DateFromFieldsOptions &&
      other.overflow == overflow &&
      other.missingFieldsStrategy == missingFieldsStrategy;

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

// dart format on
