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

part of 'lib.g.dart';

final class _BidiMirroringGlyphFfi extends ffi.Struct {
  external _ResultUint32Void mirroringGlyph;
  @ffi.Bool()
  external bool mirrored;
  @ffi.Int32()
  external int pairedBracketType;
}

/// See the [Rust documentation for `BidiMirroringGlyph`](https://docs.rs/icu/2.2.0/icu/properties/props/struct.BidiMirroringGlyph.html) for more information.
final class BidiMirroringGlyph {
  // ignore: public_member_api_docs
  Rune? mirroringGlyph;
  // ignore: public_member_api_docs
  bool mirrored;
  // ignore: public_member_api_docs
  BidiPairedBracketType pairedBracketType;

  // ignore: public_member_api_docs
  BidiMirroringGlyph({this.mirroringGlyph, required this.mirrored, required this.pairedBracketType});

  // 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
  BidiMirroringGlyph._fromFfi(_BidiMirroringGlyphFfi ffi) :
    mirroringGlyph = ffi.mirroringGlyph.isOk ? ffi.mirroringGlyph.union.ok : null,
    mirrored = ffi.mirrored,
    pairedBracketType = BidiPairedBracketType.values[ffi.pairedBracketType];

  // ignore: unused_element
  _BidiMirroringGlyphFfi _toFfi(ffi.Allocator temp) {
    final struct = ffi.Struct.create<_BidiMirroringGlyphFfi>();
    final mirroringGlyph = this.mirroringGlyph;
    struct.mirroringGlyph = mirroringGlyph != null ? _ResultUint32Void.ok(mirroringGlyph) : _ResultUint32Void.err();
    struct.mirrored = mirrored;
    struct.pairedBracketType = pairedBracketType.index;
    return struct;
  }

  /// See the [Rust documentation for `for_char`](https://docs.rs/icu/2.2.0/icu/properties/props/trait.EnumeratedProperty.html#tymethod.for_char) for more information.
  static BidiMirroringGlyph forChar(Rune ch) {
    final result = _icu4x_BidiMirroringGlyph_for_char_mv1(ch);
    return BidiMirroringGlyph._fromFfi(result);
  }


  @override
  bool operator ==(Object other) =>
      other is BidiMirroringGlyph &&
      other.mirroringGlyph == mirroringGlyph &&
      other.mirrored == mirrored &&
      other.pairedBracketType == pairedBracketType;

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

// ignore: experimental_member_use
@meta.RecordUse()
@ffi.Native<_BidiMirroringGlyphFfi Function(ffi.Uint32)>(isLeaf: true, symbol: 'icu4x_BidiMirroringGlyph_for_char_mv1')
// ignore: non_constant_identifier_names
external _BidiMirroringGlyphFfi _icu4x_BidiMirroringGlyph_for_char_mv1(Rune ch);

// dart format on
