Namespaces
Records
Functions
-
template <typename T>span<const std::byte, sizeof(T)> ObjectAsBytes (const T & obj)Gets a read-only `pw::span
<const
std::byte>` (`ConstByteSpan`) view of an
object.
This function is only available for types where it always safe to rely on
the underlying bytes of the object, i.e. serializable objects designed to be
sent over the wire. It cannot be used with, for example, types that include
padding bytes, since those are indeterminate and may leak information.
For types that do not meet these criteria, it is still possible to represent
them as bytes using `pw::as_bytes`, albeit in a manner that is unsafe for
serialization.
The returned span has a static extent.
Defined at line 45 of file ../../third_party/pigweed/src/pw_bytes/public/pw_bytes/span.h
-
template <typename T>span<std::byte, sizeof(T)> ObjectAsWritableBytes (T & obj)Gets a writable `pw::span
<std
::byte>` (`ByteSpan`) view of an object.
This function is only available for types where it always safe to rely on
the underlying bytes of the object, i.e. serializable objects designed to be
sent over the wire. It cannot be used with, for example, types that include
padding bytes, since those are indeterminate and may leak information.
For types that do not meet these criteria, it is still possible to represent
them as bytes using `pw::as_writable_bytes`, albeit in a manner that is
unsafe for serialization.
The returned span has a static extent.
Defined at line 71 of file ../../third_party/pigweed/src/pw_bytes/public/pw_bytes/span.h
-
template <typename T>const char * EnumToString (T value)Returns a string representation of a given enumerator.
Enums registered with `PW_ENUM` or `PW_STATUS_ENUM` from
`pw_enum/generate.h` support `EnumToString` automatically via
`pw::EnumTraits
<T
>::ToString`.
Other enums can support `EnumToString` via the FTADLE pattern
(https://abseil.io/tips/218) by implementing a `PwEnumToString` function in
the same namespace as the enum (for example, using `PW_TOKENIZE_ENUM` or
`PW_TOKENIZE_ENUM_CUSTOM` from `pw_tokenizer/enum.h`).
Defined at line 72 of file ../../third_party/pigweed/src/pw_enum/public/pw_enum/to_string.h
-
bool operator== (Derived lhs, Derived rhs)Defined at line 86 of file ../../third_party/pigweed/src/pw_status/public/pw_status/status_base.h
-
bool operator!= (Derived lhs, Derived rhs)Defined at line 89 of file ../../third_party/pigweed/src/pw_status/public/pw_status/status_base.h
-
bool operator== (Derived lhs, Code rhs)Defined at line 92 of file ../../third_party/pigweed/src/pw_status/public/pw_status/status_base.h
-
bool operator== (Code lhs, Derived rhs)Defined at line 95 of file ../../third_party/pigweed/src/pw_status/public/pw_status/status_base.h
-
bool operator!= (Derived lhs, Code rhs)Defined at line 98 of file ../../third_party/pigweed/src/pw_status/public/pw_status/status_base.h
-
bool operator!= (Code lhs, Derived rhs)Defined at line 101 of file ../../third_party/pigweed/src/pw_status/public/pw_status/status_base.h
-
template <typename T>const char * PwEnumDomainName ()Returns the domain name of the given enum type.
This serves as a fallback name (defaulting to `"Enum"`) for non-tokenizing
logging backends to prefix the enum's string representation.
By default, this function returns `"Enum"`. If an enum uses a custom
tokenization domain and you want non-tokenizing logging backends to prefix
the enum value with that custom domain name instead of `"Enum"`, you can
provide a custom template specialization:
Code
template <> constexpr const char* pw::PwEnumDomainName<MyEnum>() { return "CustomDomain"; }Defined at line 104 of file ../../third_party/pigweed/src/pw_enum/public/pw_enum/to_string.h
-
template <typename Enum>bool IsValidEnum (Enum value)Returns whether `value` is a valid enumerator of its enum type.
Defined at line 131 of file ../../third_party/pigweed/src/pw_enum/public/pw_enum/traits.h
-
template <typename Enum,typename Integer,typename = std::enable_if_t<internal::kIsInteger<Integer>>>bool IsValidEnum (Integer value)Returns whether the integer `value` is a valid enumerator of `Enum`. `Enum`
must be specified explicitly, e.g. `pw::IsValidEnum
<MyEnum
>(1)`.
Defined at line 144 of file ../../third_party/pigweed/src/pw_enum/public/pw_enum/traits.h
-
Status OkStatus ()Operation succeeded.
Equivalent to `Status()` or `Status(PW_STATUS_OK)`. This function is used
instead of a `Status::Ok()` function, which would be too similar to
`Status::ok()`.
Defined at line 431 of file ../../third_party/pigweed/src/pw_status/public/pw_status/status.h
Variables
const bool has_enum_to_string_v
Defined at line 57 of file ../../third_party/pigweed/src/pw_enum/public/pw_enum/to_string.h
const bool has_enum_traits_v
Defined at line 127 of file ../../third_party/pigweed/src/pw_enum/public/pw_enum/traits.h