LCOV - code coverage report

Current view
top level - src/marshalers - typed_data_marshaler.dart
Test
lcov.info
Date
2024-11-13
Legend
Lines
hit
not hit
Branches
taken
not taken
# not executed
HitTotalCoverage
Lines2626100.0%
Functions00-
Branches00-
Each row represents a line of source code
LineBranchHitsSource code
1import 'dart:typed_data';
2
3import '../converters/converter.dart';
4import 'squadron_marshaler.dart';
5
6class TypedDataMarshaler<T extends TypedData>
7 implements SquadronMarshaler<T, ByteBuffer> {
82 const TypedDataMarshaler();
9
101 @override
112 ByteBuffer marshal(T data) => data.buffer;
12
131 @override
141 T unmarshal(ByteBuffer data) {
153 final castor = _typeDataCastors[T] as Cast<T>;
163 return _td<T>(castor)(data);
171 }
18}
19
202Cast<T> _td<T>(T Function(ByteBuffer) view) =>
214 (x) => (x is T) ? x : view(x as ByteBuffer)!;
22
234final Map<Type, Cast> _typeDataCastors = {
242 ByteData: _td<ByteData>(ByteData.view),
252 Uint8ClampedList: _td<Uint8ClampedList>(Uint8ClampedList.view),
262 Uint8List: _td<Uint8List>(Uint8List.view),
272 Int8List: _td<Int8List>(Int8List.view),
282 Uint16List: _td<Uint16List>(Uint16List.view),
292 Int16List: _td<Int16List>(Int16List.view),
302 Uint32List: _td<Uint32List>(Uint32List.view),
312 Int32List: _td<Int32List>(Int32List.view),
322 Int32x4List: _td<Int32x4List>(Int32x4List.view),
332 Uint64List: _td<Uint64List>(Uint64List.view),
342 Int64List: _td<Int64List>(Int64List.view),
352 Float32List: _td<Float32List>(Float32List.view),
362 Float32x4List: _td<Float32x4List>(Float32x4List.view),
372 Float64List: _td<Float64List>(Float64List.view),
382 Float64x2List: _td<Float64x2List>(Float64x2List.view),
39};
Choose Features