44#include < string_view>
55
66#include < userver/utils/span.hpp>
7+ #include < userver/utils/string_literal.hpp>
78
89#include < userver/ugrpc/impl/rpc_type.hpp>
910
@@ -13,13 +14,13 @@ namespace ugrpc::impl {
1314
1415// / Descriptor of an RPC method
1516struct MethodDescriptor final {
16- std::string_view method_full_name;
17- RpcType method_type;
17+ utils::StringLiteral method_full_name;
18+ RpcType method_type{RpcType:: kUnary } ;
1819};
1920
2021// / Per-gRPC-service statically generated data
2122struct StaticServiceMetadata final {
22- std::string_view service_full_name;
23+ utils::StringLiteral service_full_name;
2324 utils::span<const MethodDescriptor> methods;
2425};
2526
@@ -32,13 +33,14 @@ constexpr std::size_t GetMethodsCount(const StaticServiceMetadata& metadata) noe
3233 return metadata.methods .size ();
3334}
3435
35- constexpr std::string_view GetMethodFullName (const StaticServiceMetadata& metadata, std::size_t method_id) {
36+ constexpr utils::StringLiteral GetMethodFullName (const StaticServiceMetadata& metadata, std::size_t method_id) {
3637 return metadata.methods [method_id].method_full_name ;
3738}
3839
39- constexpr std::string_view GetMethodName (const StaticServiceMetadata& metadata, std::size_t method_id) {
40- auto method_full_name = GetMethodFullName (metadata, method_id);
41- return method_full_name.substr (metadata.service_full_name .size () + 1 );
40+ constexpr utils::StringLiteral GetMethodName (const StaticServiceMetadata& metadata, std::size_t method_id) {
41+ auto result = ugrpc::impl::GetMethodFullName (metadata, method_id);
42+ result.remove_prefix (metadata.service_full_name .size () + 1 );
43+ return result;
4244}
4345
4446constexpr RpcType GetMethodType (const StaticServiceMetadata& metadata, std::size_t method_id) {
0 commit comments