userver: userver/utils/bytes_per_second.hpp Source File
Loading...
Searching...
No Matches
bytes_per_second.hpp
Go to the documentation of this file.
1#pragma once
2
6
7#include <string>
8
10
11USERVER_NAMESPACE_BEGIN
12
13namespace utils {
14
18enum class BytesPerSecond : long long {};
19
20constexpr long long ToLongLong(BytesPerSecond x) { return static_cast<long long>(x); }
21
22constexpr bool operator==(BytesPerSecond lhs, BytesPerSecond rhs) { return ToLongLong(lhs) == ToLongLong(rhs); }
23
26BytesPerSecond StringToBytesPerSecond(const std::string& data);
27
28template <class Value>
30 return utils::StringToBytesPerSecond(v.template As<std::string>());
31}
32
33} // namespace utils
34
35USERVER_NAMESPACE_END