(object value, WriteContext context)
| 329 | } |
| 330 | |
| 331 | private static bool TryWriteKnownPayload(object value, WriteContext context) |
| 332 | { |
| 333 | switch (value) |
| 334 | { |
| 335 | case bool v: |
| 336 | context.Writer.WriteUInt8(v ? (byte)1 : (byte)0); |
| 337 | return true; |
| 338 | case sbyte v: |
| 339 | context.Writer.WriteInt8(v); |
| 340 | return true; |
| 341 | case short v: |
| 342 | context.Writer.WriteInt16(v); |
| 343 | return true; |
| 344 | case int v: |
| 345 | context.Writer.WriteVarInt32(v); |
| 346 | return true; |
| 347 | case long v: |
| 348 | context.Writer.WriteVarInt64(v); |
| 349 | return true; |
| 350 | case byte v: |
| 351 | context.Writer.WriteUInt8(v); |
| 352 | return true; |
| 353 | case ushort v: |
| 354 | context.Writer.WriteUInt16(v); |
| 355 | return true; |
| 356 | case uint v: |
| 357 | context.Writer.WriteVarUInt32(v); |
| 358 | return true; |
| 359 | case ulong v: |
| 360 | context.Writer.WriteVarUInt64(v); |
| 361 | return true; |
| 362 | case Half v: |
| 363 | context.Writer.WriteUInt16(BitConverter.HalfToUInt16Bits(v)); |
| 364 | return true; |
| 365 | case BFloat16 v: |
| 366 | context.Writer.WriteUInt16(v.ToBits()); |
| 367 | return true; |
| 368 | case float v: |
| 369 | context.Writer.WriteFloat32(v); |
| 370 | return true; |
| 371 | case double v: |
| 372 | context.Writer.WriteFloat64(v); |
| 373 | return true; |
| 374 | case string v: |
| 375 | StringSerializer.WriteString(context, v); |
| 376 | return true; |
| 377 | case decimal v: |
| 378 | context.TypeResolver.GetSerializer<decimal>().WriteData(context, v, false); |
| 379 | return true; |
| 380 | case DateOnly v: |
| 381 | TimeCodec.WriteDate(context, v); |
| 382 | return true; |
| 383 | case DateTimeOffset v: |
| 384 | TimeCodec.WriteTimestamp(context, v); |
| 385 | return true; |
| 386 | case DateTime v: |
| 387 | TimeCodec.WriteTimestamp(context, TimeCodec.ToDateTimeOffset(v)); |
| 388 | return true; |
nothing calls this directly
no test coverage detected