diff --git a/deps/ox/src/ox/std/uuid.hpp b/deps/ox/src/ox/std/uuid.hpp index 6a049e042..031222bef 100644 --- a/deps/ox/src/ox/std/uuid.hpp +++ b/deps/ox/src/ox/std/uuid.hpp @@ -145,6 +145,33 @@ class UUID { return out; } + [[nodiscard]] + constexpr ox::Error toString(Writer_c auto &writer) const noexcept { + auto valueI = 0u; + constexpr auto printChars = []( + Writer_c auto &writer, + const Array &value, + std::size_t cnt, + unsigned &valueI) { + for (auto i = 0u; i < cnt; ++i) { + const auto v = value[valueI]; + const auto h = detail::toHex(v); + oxIgnoreError(writer.write(h.c_str(), h.len())); + ++valueI; + } + }; + printChars(writer, m_value, 4, valueI); + oxReturnError(writer.put('-')); + printChars(writer, m_value, 2, valueI); + oxReturnError(writer.put('-')); + printChars(writer, m_value, 2, valueI); + oxReturnError(writer.put('-')); + printChars(writer, m_value, 2, valueI); + oxReturnError(writer.put('-')); + printChars(writer, m_value, 6, valueI); + return {}; + } + [[nodiscard]] constexpr UUIDStr toString() const noexcept { UUIDStr out;