tracelogging/enums.rs
1// Copyright (c) Microsoft Corporation.
2// Licensed under the MIT license.
3
4#![allow(non_upper_case_globals)]
5
6use core::fmt;
7use core::mem::size_of;
8
9/// *Advanced:* Indicates routing and decoding for an event.
10///
11/// This should almost always be set to [Channel::TraceLogging] (11) for TraceLogging
12/// events.
13///
14/// This should almost always be set to [Channel::TraceClassic] (0) for non-TraceLogging
15/// events.
16#[repr(C)]
17#[derive(Clone, Copy, Debug, Default, Eq, Hash, Ord, PartialEq, PartialOrd)]
18pub struct Channel(u8);
19
20impl Channel {
21 /// Returns a channel with the specified value.
22 #[inline(always)]
23 pub const fn from_int(value: u8) -> Channel {
24 return Channel(value);
25 }
26
27 /// Returns the integer value of this channel.
28 #[inline(always)]
29 pub const fn as_int(self) -> u8 {
30 return self.0;
31 }
32
33 /// Channel for non-TraceLogging events.
34 pub const TraceClassic: Channel = Channel(0);
35
36 /// Channel for TraceLogging events.
37 ///
38 /// TraceLogging events with channel set to a value other than
39 /// [TraceLogging](Channel::TraceLogging) (11) might not decode correctly if they are
40 /// collected on a system running Windows 8.1 or before.
41 pub const TraceLogging: Channel = Channel(11);
42
43 /// Channel for events from machine-generated manifests.
44 pub const ProviderMetadata: Channel = Channel(12);
45}
46
47impl fmt::Display for Channel {
48 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
49 return self.0.fmt(f);
50 }
51}
52
53impl From<u8> for Channel {
54 fn from(val: u8) -> Self {
55 return Self(val);
56 }
57}
58
59impl From<Channel> for u8 {
60 fn from(val: Channel) -> Self {
61 return val.0;
62 }
63}
64
65/// Indicates the severity of an event. Use Verbose if unsure.
66#[repr(C)]
67#[derive(Clone, Copy, Debug, Default, Eq, Hash, Ord, PartialEq, PartialOrd)]
68pub struct Level(pub(crate) u8);
69
70impl Level {
71 /// Returns a level with the specified value.
72 #[inline(always)]
73 pub const fn from_int(value: u8) -> Level {
74 return Level(value);
75 }
76
77 /// Returns the integer value of this level.
78 #[inline(always)]
79 pub const fn as_int(self) -> u8 {
80 return self.0;
81 }
82
83 /// Event ignores level-based filtering. This level should almost never be used.
84 pub const LogAlways: Level = Level(0);
85 /// Critical error event.
86 pub const Critical: Level = Level(1);
87 /// Error event.
88 pub const Error: Level = Level(2);
89 /// Warning event.
90 pub const Warning: Level = Level(3);
91 /// Informational event.
92 pub const Informational: Level = Level(4);
93 /// Verbose event.
94 pub const Verbose: Level = Level(5);
95}
96
97impl fmt::Display for Level {
98 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
99 return self.0.fmt(f);
100 }
101}
102
103impl From<u8> for Level {
104 fn from(val: u8) -> Self {
105 return Self(val);
106 }
107}
108
109impl From<Level> for u8 {
110 fn from(val: Level) -> Self {
111 return val.0;
112 }
113}
114
115/// Indicates special semantics to be used by the event decoder for grouping and
116/// organizing events, e.g. for activities.
117///
118/// For example, the [Opcode::ActivityStart] opcode indicates the beginning of an activity and
119/// the [Opcode::ActivityStop] indicates the end of an activity. Most events use [Opcode::Info]
120/// (0).
121#[repr(C)]
122#[derive(Clone, Copy, Debug, Default, Eq, Hash, Ord, PartialEq, PartialOrd)]
123pub struct Opcode(u8);
124
125impl Opcode {
126 /// Returns an opcode with the specified value.
127 #[inline(always)]
128 pub const fn from_int(value: u8) -> Opcode {
129 return Opcode(value);
130 }
131
132 /// Returns the integer value of this opcode.
133 #[inline(always)]
134 pub const fn as_int(self) -> u8 {
135 return self.0;
136 }
137
138 /// Normal event. The event may set activity_id if it is part of an activity.
139 pub const Info: Opcode = Opcode(0);
140
141 /// Event indicates the beginning of an activity. The event should set related_id to
142 /// the id of the parent activity and should set activity_id to the id of the
143 /// newly-started activity. All subsequent events that use the new activity_id will
144 /// be considered as part of this activity, up to the corresponding
145 /// [ActivityStop](Opcode::ActivityStop) event.
146 pub const ActivityStart: Opcode = Opcode(1);
147
148 /// Event indicates the end of an activity. The event should set activity_id
149 /// to the id of the activity that is ending and should use the same level
150 /// and keyword as were used for the corresponding
151 /// [ActivityStart](Opcode::ActivityStart) event.
152 pub const ActivityStop: Opcode = Opcode(2);
153
154 /// Data Collection Start event
155 pub const CollectionStart: Opcode = Opcode(3);
156
157 /// Data Collection Stop event
158 pub const CollectionStop: Opcode = Opcode(4);
159
160 /// Extension event
161 pub const Extension: Opcode = Opcode(5);
162
163 /// Reply event
164 pub const Reply: Opcode = Opcode(6);
165
166 /// Resume event
167 pub const Resume: Opcode = Opcode(7);
168
169 /// Suspend event
170 pub const Suspend: Opcode = Opcode(8);
171
172 /// Message Send event
173 pub const Send: Opcode = Opcode(9);
174
175 /// Message Receive event
176 pub const Receive: Opcode = Opcode(240);
177
178 /// Reserved for future definition by Microsoft
179 pub const ReservedOpcode241: Opcode = Opcode(241);
180
181 /// Reserved for future definition by Microsoft
182 pub const ReservedOpcode242: Opcode = Opcode(242);
183
184 /// Reserved for future definition by Microsoft
185 pub const ReservedOpcode243: Opcode = Opcode(243);
186
187 /// Reserved for future definition by Microsoft
188 pub const ReservedOpcode244: Opcode = Opcode(244);
189
190 /// Reserved for future definition by Microsoft
191 pub const ReservedOpcode245: Opcode = Opcode(245);
192
193 /// Reserved for future definition by Microsoft
194 pub const ReservedOpcode246: Opcode = Opcode(246);
195
196 /// Reserved for future definition by Microsoft
197 pub const ReservedOpcode247: Opcode = Opcode(247);
198
199 /// Reserved for future definition by Microsoft
200 pub const ReservedOpcode248: Opcode = Opcode(248);
201
202 /// Reserved for future definition by Microsoft
203 pub const ReservedOpcode249: Opcode = Opcode(249);
204
205 /// Reserved for future definition by Microsoft
206 pub const ReservedOpcode250: Opcode = Opcode(250);
207
208 /// Reserved for future definition by Microsoft
209 pub const ReservedOpcode251: Opcode = Opcode(251);
210
211 /// Reserved for future definition by Microsoft
212 pub const ReservedOpcode252: Opcode = Opcode(252);
213
214 /// Reserved for future definition by Microsoft
215 pub const ReservedOpcode253: Opcode = Opcode(253);
216
217 /// Reserved for future definition by Microsoft
218 pub const ReservedOpcode254: Opcode = Opcode(254);
219
220 /// Reserved for future definition by Microsoft
221 pub const ReservedOpcode255: Opcode = Opcode(255);
222
223 /// Alias for `ActivityStart`.
224 /// Deprecated - prefer [`ActivityStart`](Opcode::ActivityStart).
225 pub const Start: Opcode = Self::ActivityStart;
226
227 /// Alias for `ActivityStop`.
228 /// Deprecated - prefer [`ActivityStop`](Opcode::ActivityStop).
229 pub const Stop: Opcode = Self::ActivityStop;
230
231 /// Alias for `CollectionStart`.
232 /// Deprecated - prefer [`CollectionStart`](Opcode::CollectionStart).
233 pub const DC_Start: Opcode = Self::CollectionStart;
234
235 /// Alias for `CollectionStop`.
236 /// Deprecated - prefer [`CollectionStop`](Opcode::CollectionStop).
237 pub const DC_Stop: Opcode = Self::CollectionStop;
238}
239
240impl fmt::Display for Opcode {
241 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
242 return self.0.fmt(f);
243 }
244}
245
246impl From<u8> for Opcode {
247 fn from(val: u8) -> Self {
248 return Self(val);
249 }
250}
251
252impl From<Opcode> for u8 {
253 fn from(val: Opcode) -> Self {
254 return val.0;
255 }
256}
257
258/// *Advanced:* Used to indicate the field's type for raw metadata operations.
259///
260/// An InType indicates the binary encoding of the field, i.e. how to determine the
261/// field's size. For example, [InType::I32] indicates the field is always 4 bytes,
262/// while [InType::Str8] indicates the field begins with a U16 byte-count to specify the
263/// field's size. The InType also provides a default format to be used if a field's
264/// [OutType] is [OutType::Default], e.g. [InType::I32] defaults to [OutType::Signed],
265/// and [InType::Hex32] defaults to [OutType::Hex].
266#[repr(C)]
267#[derive(Clone, Copy, Debug, Default, Eq, Hash, Ord, PartialEq, PartialOrd)]
268pub struct InType(u8);
269
270impl InType {
271 /// Returns an intype with the specified value.
272 /// Requires: `value <= 127`.
273 pub const fn from_int(value: u8) -> InType {
274 assert!(value <= 127, "InType requires value <= 127");
275 return InType(value);
276 }
277
278 /// Returns the numeric value corresponding to this intype.
279 #[inline(always)]
280 pub const fn as_int(self) -> u8 {
281 return self.0;
282 }
283
284 /// TlgInNULL = Invalid type.
285 pub const Invalid: InType = InType(0);
286
287 /// TlgInUNICODESTRING = NUL-terminated UTF-16LE string.
288 ///
289 /// Default format: [OutType::String]
290 ///
291 /// Other usable formats: [OutType::Xml], [OutType::Json].
292 pub const CStr16: InType = InType(1);
293
294 /// TlgInANSISTRING = NUL-terminated 8-bit string, assumed to be encoded as CP1252.
295 ///
296 /// Default format: [OutType::String]
297 ///
298 /// Other usable formats: [OutType::Xml], [OutType::Json], [OutType::Utf8].
299 pub const CStr8: InType = InType(2);
300
301 /// TlgInINT8 = 8-bit signed integer.
302 ///
303 /// Default format: [OutType::Signed]
304 ///
305 /// Other usable formats: [OutType::String] (formats as CP1252 char).
306 pub const I8: InType = InType(3);
307
308 /// TlgInUINT8 = 8-bit unsigned integer.
309 ///
310 /// Default format: [OutType::Unsigned]
311 ///
312 /// Other usable formats: [OutType::Hex], [OutType::String] (formats as CP1252 char),
313 /// [OutType::Boolean].
314 pub const U8: InType = InType(4);
315
316 /// TlgInINT16 = 16-bit signed integer.
317 ///
318 /// Default format: [OutType::Signed]
319 pub const I16: InType = InType(5);
320
321 /// TlgInUINT16 = 16-bit unsigned integer.
322 ///
323 /// Default format: [OutType::Unsigned]
324 ///
325 /// Other usable formats: [OutType::Hex], [OutType::String] (formats as UCS-2 char),
326 /// [OutType::Port] (formats as big-endian `u16`).
327 pub const U16: InType = InType(6);
328
329 /// TlgInINT32 = 32-bit signed integer.
330 ///
331 /// Default format: [OutType::Signed]
332 ///
333 /// Other usable formats: [OutType::HResult].
334 pub const I32: InType = InType(7);
335
336 /// TlgInUINT32 = 32-bit unsigned integer.
337 ///
338 /// Default format: [OutType::Unsigned]
339 ///
340 /// Other usable formats: [OutType::Pid], [OutType::Tid], [OutType::IPv4],
341 /// [OutType::Win32Error], [OutType::NtStatus], [OutType::CodePointer].
342 pub const U32: InType = InType(8);
343
344 /// TlgInINT64 = 64-bit signed integer.
345 ///
346 /// Default format: [OutType::Signed]
347 pub const I64: InType = InType(9);
348
349 /// TlgInUINT64 = 64-bit signed integer.
350 ///
351 /// Default format: [OutType::Unsigned]
352 ///
353 /// Other usable formats: [OutType::CodePointer].
354 pub const U64: InType = InType(10);
355
356 /// TlgInFLOAT = 32-bit float.
357 pub const F32: InType = InType(11);
358
359 /// TlgInDOUBLE = 64-bit float.
360 pub const F64: InType = InType(12);
361
362 /// TlgInBOOL32 = 32-bit Boolean.
363 ///
364 /// Default format: [OutType::Boolean]
365 pub const Bool32: InType = InType(13);
366
367 /// TlgInBINARY = UINT16 byte-count followed by binary data.
368 ///
369 /// Default format: [OutType::Hex]
370 ///
371 /// Other usable formats: [OutType::IPv6], [OutType::SocketAddress],
372 /// [OutType::Pkcs7WithTypeInfo].
373 ///
374 /// Note: Array of Binary is not supported. For arrays, use [InType::BinaryC].
375 pub const Binary: InType = InType(14);
376
377 /// TlgInGUID = 128-bit GUID in Windows (little-endian) byte order.
378 pub const Guid: InType = InType(15);
379
380 /// _TlgInPOINTER_unsupported = Not supported. Use [InType::HexSize] instead.
381 pub const _HexSize_PlatformSpecific: InType = InType(16);
382
383 /// TlgInFILETIME = 64-bit timestamp in Windows
384 /// [FILETIME](https://docs.microsoft.com/windows/win32/api/minwinbase/ns-minwinbase-filetime)
385 /// format.
386 ///
387 /// Default format: [OutType::DateTime]
388 ///
389 /// Other usable formats: [OutType::DateTimeCultureInsensitive],
390 /// [OutType::DateTimeUtc].
391 pub const FileTime: InType = InType(17);
392
393 /// TlgInSYSTEMTIME = 128-bit date/time in Windows
394 /// [SYSTEMTIME](https://docs.microsoft.com/windows/win32/api/minwinbase/ns-minwinbase-systemtime)
395 /// format.
396 ///
397 /// Default format: [OutType::DateTime]
398 ///
399 /// Other usable formats: [OutType::DateTimeCultureInsensitive],
400 /// [OutType::DateTimeUtc].
401 pub const SystemTime: InType = InType(18);
402
403 /// TlgInSID = Security ID in Windows
404 /// [SID](https://docs.microsoft.com/windows/win32/api/winnt/ns-winnt-sid)
405 /// format.
406 ///
407 /// Note: Expected size of value is
408 /// [`GetSidLength(sid_bytes)`](https://docs.microsoft.com/windows/win32/api/securitybaseapi/nf-securitybaseapi-getlengthsid)
409 /// = `sid_bytes[1] * 4 + 8`.
410 pub const Sid: InType = InType(19);
411
412 /// TlgInHEXINT32 = 32-bit integer formatted as hex.
413 ///
414 /// Default format: [OutType::Hex]
415 ///
416 /// Other usable formats: [OutType::Win32Error], [OutType::NtStatus],
417 /// [OutType::CodePointer].
418 pub const Hex32: InType = InType(20);
419
420 /// TlgInHEXINT64 = 64-bit integer formatted as hex.
421 ///
422 /// Default format: [OutType::Hex]
423 ///
424 /// Other usable formats: [OutType::CodePointer].
425 pub const Hex64: InType = InType(21);
426
427 /// TlgInCOUNTEDSTRING = 16-bit byte count followed by UTF-16LE string.
428 ///
429 /// Default format: [OutType::String]
430 ///
431 /// Other usable formats: [OutType::Xml], [OutType::Json].
432 pub const Str16: InType = InType(22);
433
434 /// TlgInCOUNTEDANSISTRING = 16-bit byte count followed by 8-bit string, assumed
435 /// to be encoded as CP1252.
436 ///
437 /// Default format: [OutType::String]
438 ///
439 /// Other usable formats: [OutType::Xml], [OutType::Json], [OutType::Utf8].
440 pub const Str8: InType = InType(23);
441
442 /// _TlgInSTRUCT = The struct field contains no data, but the following N fields
443 /// will be considered as logically part of the struct field, where
444 /// N is a value from 1 to 127 encoded into the OutType slot.
445 pub const Struct: InType = InType(24);
446
447 /// TlgInCOUNTEDBINARY = UINT16 byte-count followed by binary data.
448 ///
449 /// Default format: [OutType::Hex]
450 ///
451 /// Other usable formats: [OutType::IPv6], [OutType::SocketAddress],
452 /// [OutType::Pkcs7WithTypeInfo].
453 ///
454 /// This is the same as [InType::Binary] except:
455 /// - New type code. Decoders might not support it yet.
456 /// - Decodes without the synthesized "FieldName.Length" fields that are common
457 /// with Binary.
458 /// - Arrays are supported.
459 pub const BinaryC: InType = InType(25);
460
461 /// TlgInINTPTR = an alias for either [InType::I64] or [InType::I32], depending on
462 /// the running process's pointer size.
463 ///
464 /// Default format: [OutType::Signed]
465 pub const ISize: InType = if size_of::<usize>() == 8 {
466 InType::I64
467 } else {
468 InType::I32
469 };
470
471 /// TlgInUINTPTR = an alias for either [InType::U64] or [InType::U32], depending on
472 /// the running process's pointer size.
473 ///
474 /// Default format: [OutType::Unsigned]
475 ///
476 /// Other usable formats: [OutType::CodePointer].
477 pub const USize: InType = if size_of::<usize>() == 8 {
478 InType::U64
479 } else {
480 InType::U32
481 };
482
483 /// TlgInPOINTER = an alias for either [InType::Hex64] or [InType::Hex32], depending
484 /// on the running process's pointer size.
485 ///
486 /// Default format: [OutType::Hex]
487 ///
488 /// Other usable formats: [OutType::CodePointer].
489 pub const HexSize: InType = if size_of::<usize>() == 8 {
490 InType::Hex64
491 } else {
492 InType::Hex32
493 };
494
495 /// Raw encoding flag: _TlgInCcount indicates that field metadata contains a
496 /// const-array-count slot.
497 pub const ConstantCountFlag: u8 = 0x20;
498
499 /// Raw encoding flag: TlgInVcount indicates that field data contains a
500 /// variable-array-count slot.
501 pub const VariableCountFlag: u8 = 0x40;
502
503 /// Raw encoding flag: _TlgInCustom indicates that the field uses a custom
504 /// serializer.
505 pub const CustomFlag: u8 = 0x60;
506
507 /// Raw encoding flag: _TlgInTypeMask is a mask for the intype portion of the encoded
508 /// byte.
509 pub const TypeMask: u8 = 0x1F;
510
511 /// Raw encoding flag: _TlgInFlagMask is a mask for the flags portion of the encoded
512 /// byte.
513 pub const FlagMask: u8 = 0x60;
514}
515
516impl fmt::Display for InType {
517 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
518 return self.0.fmt(f);
519 }
520}
521
522impl From<u8> for InType {
523 fn from(val: u8) -> Self {
524 return Self(val);
525 }
526}
527
528impl From<InType> for u8 {
529 fn from(val: InType) -> Self {
530 return val.0;
531 }
532}
533
534/// Data formatting hint that may be used or ignored by decoders.
535///
536/// Each field of an event has an [InType] (specifies the field's binary
537/// encoding) and an [OutType] (formatting hint for the decoder).
538///
539/// If a field has an OutType set and the decoder supports the field's
540/// combination of InType + OutType then the decoder will use the OutType as a
541/// formatting hint when decoding the field.
542///
543/// For example, a field with [InType::U8] and [OutType::Default] is formatted as
544/// decimal. If the field sets [OutType::Hex] and the decoder supports U8+Hex then the
545/// field would be formatted as hexadecimal. If the field sets [OutType::String] and the
546/// decoder supports U8+String then it would be formatted as a CP1252 CHAR.
547///
548/// If the OutType is [OutType::Default] or is not supported by the decoder then the
549/// field receives a default formatting based on the field's InType.
550///
551/// Note: Setting the OutType to a value other than Default will add 1 byte per
552/// field per event in the resulting ETL file. Add a non-Default OutType only if
553/// [OutType::Default] does not produce the desired format.
554#[repr(C)]
555#[derive(Clone, Copy, Debug, Default, Eq, Hash, Ord, PartialEq, PartialOrd)]
556pub struct OutType(u8);
557
558impl OutType {
559 /// Returns an OutType with the specified value.
560 /// Requires: `value <= 127`.
561 pub const fn from_int(value: u8) -> OutType {
562 assert!(value <= 127, "OutType requires value <= 127");
563 return OutType(value);
564 }
565
566 /// Returns the numeric value corresponding to this OutType.
567 #[inline(always)]
568 pub const fn as_int(self) -> u8 {
569 return self.0;
570 }
571
572 /// TlgOutNULL = default formatting will be applied based on the field's InType.
573 pub const Default: OutType = OutType(0);
574 /// TlgOutNOPRINT = field should be hidden. (Most decoders show it anyway.)
575 pub const NoPrint: OutType = OutType(1);
576 /// TlgOutSTRING = field should be formatted as a string. Use with [InType::I8],
577 /// [InType::U8], or [InType::U16] to log a char.
578 pub const String: OutType = OutType(2);
579 /// TlgOutBOOLEAN = field should be formatted as a Boolean. Use with [InType::U8].
580 pub const Boolean: OutType = OutType(3);
581 /// TlgOutHEX = field should be formatted as hexadecimal. Use with [InType::U8],
582 /// [InType::U16].
583 pub const Hex: OutType = OutType(4);
584 /// TlgOutPID = field should be formatted as a process id. Use with [InType::U32].
585 pub const Pid: OutType = OutType(5);
586 /// TlgOutTID = field should be formatted as a thread id. Use with [InType::U32].
587 pub const Tid: OutType = OutType(6);
588 /// TlgOutPORT = field should be formatted as a big-endian IP port. Use with
589 /// [InType::U16].
590 pub const Port: OutType = OutType(7);
591 /// TlgOutIPV4 = field should be formatted as an IPv4 address. Use with
592 /// [InType::U32].
593 pub const IPv4: OutType = OutType(8);
594 /// TlgOutIPV6 = field should be formatted as an IPv6 address. Use with
595 /// [InType::Binary] or [InType::BinaryC].
596 pub const IPv6: OutType = OutType(9);
597 /// TlgOutSOCKETADDRESS = field should be formatted as a sockaddr. Use with
598 /// [InType::Binary] or [InType::BinaryC].
599 pub const SocketAddress: OutType = OutType(10);
600 /// TlgOutXML = field should be formatted as XML. Use with [InType::Str16],
601 /// [InType::Str8], [InType::CStr16], and [InType::CStr8] types. Implies UTF-8 when
602 /// used with [InType::Str8] or [InType::CStr8].
603 pub const Xml: OutType = OutType(11);
604 /// TlgOutJSON = field should be formatted as JSON. Use with [InType::Str16],
605 /// [InType::Str8], [InType::CStr16], and [InType::CStr8] types. Implies UTF-8 when
606 /// used with [InType::Str8] or [InType::CStr8].
607 pub const Json: OutType = OutType(12);
608 /// TlgOutWIN32ERROR = field should be formatted as a Win32 result code. Use with
609 /// [InType::U32].
610 pub const Win32Error: OutType = OutType(13);
611 /// TlgOutNTSTATUS = field should be formatted as a Win32 NTSTATUS. Use with
612 /// [InType::U32].
613 pub const NtStatus: OutType = OutType(14);
614 /// TlgOutHRESULT = field should be formatted as a Win32 HRESULT. Use with
615 /// [InType::I32].
616 pub const HResult: OutType = OutType(15);
617 /// TlgOutFILETIME = not generally used. Appropriate InTypes already imply DateTime.
618 pub const DateTime: OutType = OutType(16);
619 /// TlgOutSIGNED = not generally used. Appropriate InTypes already imply Signed.
620 pub const Signed: OutType = OutType(17);
621 /// TlgOutUNSIGNED = not generally used. Appropriate InTypes already imply Unsigned.
622 pub const Unsigned: OutType = OutType(18);
623 /// TlgOutDATETIME_CULTURE_INSENSITIVE = Invariant-culture date-time. Use with
624 /// [InType::FileTime] or [InType::SystemTime].
625 pub const DateTimeCultureInsensitive: OutType = OutType(33);
626 /// TlgOutUTF8 = field should be decoded as UTF-8. Use with [InType::Str8] or
627 /// [InType::CStr8].
628 pub const Utf8: OutType = OutType(35);
629 /// TlgOutPKCS7_WITH_TYPE_INFO = field should be decoded as a PKCS7 packet followed
630 /// by TLG type info. Use with [InType::Binary] or [InType::BinaryC].
631 pub const Pkcs7WithTypeInfo: OutType = OutType(36);
632 /// TlgOutCODE_POINTER = field should be formatted as a code pointer. Use with
633 /// [InType::U32], [InType::U64], [InType::USize], [InType::Hex32], [InType::Hex64],
634 /// [InType::HexSize].
635 pub const CodePointer: OutType = OutType(37);
636 /// TlgOutDATETIME_UTC = field should be decoded assuming UTC timezone. Use with
637 /// [InType::FileTime] or [InType::SystemTime].
638 pub const DateTimeUtc: OutType = OutType(38);
639 /// _TlgOutTypeMask = raw encoding flag: mask for the outtype portion of the encoded
640 /// byte.
641 pub const TypeMask: u8 = 0x7F;
642}
643
644impl fmt::Display for OutType {
645 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
646 return self.0.fmt(f);
647 }
648}
649
650impl From<u8> for OutType {
651 fn from(val: u8) -> Self {
652 return Self(val);
653 }
654}
655
656impl From<OutType> for u8 {
657 fn from(val: OutType) -> Self {
658 return val.0;
659 }
660}