blob: 57bee77abf404339187fcfaf4f52b3e0a74d7fde [file] [log] [blame]
// generated by diplomat-tool
// dart format off
part of 'lib.g.dart';
final class _CollatorResolvedOptionsFfi extends ffi.Struct {
@ffi.Int32()
external int strength;
@ffi.Int32()
external int alternateHandling;
@ffi.Int32()
external int caseFirst;
@ffi.Int32()
external int maxVariable;
@ffi.Int32()
external int caseLevel;
@ffi.Int32()
external int numeric;
}
/// See the [Rust documentation for `ResolvedCollatorOptions`](https://docs.rs/icu/2.0.0/icu/collator/options/struct.ResolvedCollatorOptions.html) for more information.
final class CollatorResolvedOptions {
final CollatorStrength strength;
final CollatorAlternateHandling alternateHandling;
final CollatorCaseFirst caseFirst;
final CollatorMaxVariable maxVariable;
final CollatorCaseLevel caseLevel;
final CollatorNumericOrdering numeric;
// 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
CollatorResolvedOptions._fromFfi(_CollatorResolvedOptionsFfi ffi) :
strength = CollatorStrength.values[ffi.strength],
alternateHandling = CollatorAlternateHandling.values[ffi.alternateHandling],
caseFirst = CollatorCaseFirst.values[ffi.caseFirst],
maxVariable = CollatorMaxVariable.values[ffi.maxVariable],
caseLevel = CollatorCaseLevel.values[ffi.caseLevel],
numeric = CollatorNumericOrdering.values[ffi.numeric];
// ignore: unused_element
_CollatorResolvedOptionsFfi _toFfi(ffi.Allocator temp) {
final struct = ffi.Struct.create<_CollatorResolvedOptionsFfi>();
struct.strength = strength.index;
struct.alternateHandling = alternateHandling.index;
struct.caseFirst = caseFirst.index;
struct.maxVariable = maxVariable.index;
struct.caseLevel = caseLevel.index;
struct.numeric = numeric.index;
return struct;
}
@override
bool operator ==(Object other) =>
other is CollatorResolvedOptions &&
other.strength == strength &&
other.alternateHandling == alternateHandling &&
other.caseFirst == caseFirst &&
other.maxVariable == maxVariable &&
other.caseLevel == caseLevel &&
other.numeric == numeric;
@override
int get hashCode => Object.hashAll([
strength,
alternateHandling,
caseFirst,
maxVariable,
caseLevel,
numeric,
]);
}
// dart format on