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