Pigweed
 
Loading...
Searching...
No Matches
find.h File Reference
#include "pw_bytes/span.h"
#include "pw_protobuf/decoder.h"
#include "pw_protobuf/stream_decoder.h"
#include "pw_result/result.h"
#include "pw_status/try.h"
#include "pw_string/string.h"

Go to the source code of this file.

Classes

class  pw::protobuf::Finder< T, kReadFn >
 
class  pw::protobuf::StreamFinder< T, kReadFn >
 
class  pw::protobuf::EnumFinder< T >
 
class  pw::protobuf::EnumStreamFinder< T >
 

Namespaces

namespace  pw
 Provides basic helpers for reading and writing UTF-8 encoded strings.
 

Typedefs

using pw::protobuf::Uint32Finder = Finder< uint32_t, &Decoder::ReadUint32 >
 
using pw::protobuf::Uint32StreamFinder = StreamFinder< uint32_t, &StreamDecoder::ReadUint32 >
 
using pw::protobuf::Int32Finder = Finder< int32_t, &Decoder::ReadInt32 >
 
using pw::protobuf::Int32StreamFinder = StreamFinder< int32_t, &StreamDecoder::ReadInt32 >
 
using pw::protobuf::Sint32Finder = Finder< int32_t, &Decoder::ReadSint32 >
 
using pw::protobuf::Sint32StreamFinder = StreamFinder< int32_t, &StreamDecoder::ReadSint32 >
 
using pw::protobuf::Uint64Finder = Finder< uint64_t, &Decoder::ReadUint64 >
 
using pw::protobuf::Uint64StreamFinder = StreamFinder< uint64_t, &StreamDecoder::ReadUint64 >
 
using pw::protobuf::Int64Finder = Finder< int64_t, &Decoder::ReadInt64 >
 
using pw::protobuf::Int64StreamFinder = StreamFinder< int64_t, &StreamDecoder::ReadInt64 >
 
using pw::protobuf::Sint64Finder = Finder< int64_t, &Decoder::ReadSint64 >
 
using pw::protobuf::Sint64StreamFinder = StreamFinder< int64_t, &StreamDecoder::ReadSint64 >
 
using pw::protobuf::BoolFinder = Finder< bool, &Decoder::ReadBool >
 
using pw::protobuf::BoolStreamFinder = StreamFinder< bool, &StreamDecoder::ReadBool >
 
using pw::protobuf::Fixed32Finder = Finder< uint32_t, &Decoder::ReadFixed32 >
 
using pw::protobuf::Fixed32StreamFinder = StreamFinder< uint32_t, &StreamDecoder::ReadFixed32 >
 
using pw::protobuf::Fixed64Finder = Finder< uint64_t, &Decoder::ReadFixed64 >
 
using pw::protobuf::Fixed64StreamFinder = StreamFinder< uint64_t, &StreamDecoder::ReadFixed64 >
 
using pw::protobuf::Sfixed32Finder = Finder< int32_t, &Decoder::ReadSfixed32 >
 
using pw::protobuf::Sfixed32StreamFinder = StreamFinder< int32_t, &StreamDecoder::ReadSfixed32 >
 
using pw::protobuf::Sfixed64Finder = Finder< int64_t, &Decoder::ReadSfixed64 >
 
using pw::protobuf::Sfixed64StreamFinder = StreamFinder< int64_t, &StreamDecoder::ReadSfixed64 >
 
using pw::protobuf::FloatFinder = Finder< float, &Decoder::ReadFloat >
 
using pw::protobuf::FloatStreamFinder = StreamFinder< float, &StreamDecoder::ReadFloat >
 
using pw::protobuf::DoubleFinder = Finder< double, &Decoder::ReadDouble >
 
using pw::protobuf::DoubleStreamFinder = StreamFinder< double, &StreamDecoder::ReadDouble >
 
using pw::protobuf::StringFinder = Finder< std::string_view, &Decoder::ReadString >
 
using pw::protobuf::BytesFinder = Finder< ConstByteSpan, &Decoder::ReadBytes >
 

Functions

Status pw::protobuf::internal::AdvanceToField (Decoder &decoder, uint32_t field_number)
 
Status pw::protobuf::internal::AdvanceToField (StreamDecoder &decoder, uint32_t field_number)
 
template<typename T , auto kReadFn>
Result< T > pw::protobuf::internal::Find (ConstByteSpan message, uint32_t field_number)
 
template<typename T , auto kReadFn>
Result< T > pw::protobuf::internal::Find (stream::Reader &reader, uint32_t field_number)
 
Result< uint32_t > pw::protobuf::FindUint32 (ConstByteSpan message, uint32_t field_number)
 Scans a serialized protobuf message for a uint32 field.
 
template<typename T , typename = std::enable_if_t<std::is_enum_v<T>>>
Result< uint32_t > pw::protobuf::FindUint32 (ConstByteSpan message, T field)
 
Result< uint32_t > pw::protobuf::FindUint32 (stream::Reader &message_stream, uint32_t field_number)
 Scans a serialized protobuf message for a uint32 field.
 
template<typename T , typename = std::enable_if_t<std::is_enum_v<T>>>
Result< uint32_t > pw::protobuf::FindUint32 (stream::Reader &message_stream, T field)
 
Result< int32_t > pw::protobuf::FindInt32 (ConstByteSpan message, uint32_t field_number)
 Scans a serialized protobuf message for an int32 field.
 
template<typename T , typename = std::enable_if_t<std::is_enum_v<T>>>
Result< int32_t > pw::protobuf::FindInt32 (ConstByteSpan message, T field)
 
Result< int32_t > pw::protobuf::FindInt32 (stream::Reader &message_stream, uint32_t field_number)
 Scans a serialized protobuf message for an int32 field.
 
template<typename T , typename = std::enable_if_t<std::is_enum_v<T>>>
Result< int32_t > pw::protobuf::FindInt32 (stream::Reader &message_stream, T field)
 
Result< int32_t > pw::protobuf::FindSint32 (ConstByteSpan message, uint32_t field_number)
 Scans a serialized protobuf message for an sint32 field.
 
template<typename T , typename = std::enable_if_t<std::is_enum_v<T>>>
Result< int32_t > pw::protobuf::FindSint32 (ConstByteSpan message, T field)
 
Result< int32_t > pw::protobuf::FindSint32 (stream::Reader &message_stream, uint32_t field_number)
 Scans a serialized protobuf message for an sint32 field.
 
template<typename T , typename = std::enable_if_t<std::is_enum_v<T>>>
Result< int32_t > pw::protobuf::FindSint32 (stream::Reader &message_stream, T field)
 
Result< uint64_t > pw::protobuf::FindUint64 (ConstByteSpan message, uint32_t field_number)
 Scans a serialized protobuf message for a uint64 field.
 
template<typename T , typename = std::enable_if_t<std::is_enum_v<T>>>
Result< uint64_t > pw::protobuf::FindUint64 (ConstByteSpan message, T field)
 
Result< uint64_t > pw::protobuf::FindUint64 (stream::Reader &message_stream, uint32_t field_number)
 Scans a serialized protobuf message for a uint64 field.
 
template<typename T , typename = std::enable_if_t<std::is_enum_v<T>>>
Result< uint64_t > pw::protobuf::FindUint64 (stream::Reader &message_stream, T field)
 
Result< int64_t > pw::protobuf::FindInt64 (ConstByteSpan message, uint32_t field_number)
 Scans a serialized protobuf message for an int64 field.
 
template<typename T , typename = std::enable_if_t<std::is_enum_v<T>>>
Result< int64_t > pw::protobuf::FindInt64 (ConstByteSpan message, T field)
 
Result< int64_t > pw::protobuf::FindInt64 (stream::Reader &message_stream, uint32_t field_number)
 Scans a serialized protobuf message for an int64 field.
 
template<typename T , typename = std::enable_if_t<std::is_enum_v<T>>>
Result< int64_t > pw::protobuf::FindInt64 (stream::Reader &message_stream, T field)
 
Result< int64_t > pw::protobuf::FindSint64 (ConstByteSpan message, uint32_t field_number)
 Scans a serialized protobuf message for an sint64 field.
 
template<typename T , typename = std::enable_if_t<std::is_enum_v<T>>>
Result< int64_t > pw::protobuf::FindSint64 (ConstByteSpan message, T field)
 
Result< int64_t > pw::protobuf::FindSint64 (stream::Reader &message_stream, uint32_t field_number)
 Scans a serialized protobuf message for an sint64 field.
 
template<typename T , typename = std::enable_if_t<std::is_enum_v<T>>>
Result< int64_t > pw::protobuf::FindSint64 (stream::Reader &message_stream, T field)
 
Result< bool > pw::protobuf::FindBool (ConstByteSpan message, uint32_t field_number)
 Scans a serialized protobuf message for a bool field.
 
template<typename T , typename = std::enable_if_t<std::is_enum_v<T>>>
Result< bool > pw::protobuf::FindBool (ConstByteSpan message, T field)
 
Result< bool > pw::protobuf::FindBool (stream::Reader &message_stream, uint32_t field_number)
 Scans a serialized protobuf message for a bool field.
 
template<typename T , typename = std::enable_if_t<std::is_enum_v<T>>>
Result< bool > pw::protobuf::FindBool (stream::Reader &message_stream, T field)
 
Result< uint32_t > pw::protobuf::FindFixed32 (ConstByteSpan message, uint32_t field_number)
 Scans a serialized protobuf message for a fixed32 field.
 
template<typename T , typename = std::enable_if_t<std::is_enum_v<T>>>
Result< uint32_t > pw::protobuf::FindFixed32 (ConstByteSpan message, T field)
 
Result< uint32_t > pw::protobuf::FindFixed32 (stream::Reader &message_stream, uint32_t field_number)
 Scans a serialized protobuf message for a fixed32 field.
 
template<typename T , typename = std::enable_if_t<std::is_enum_v<T>>>
Result< uint32_t > pw::protobuf::FindFixed32 (stream::Reader &message_stream, T field)
 
Result< uint64_t > pw::protobuf::FindFixed64 (ConstByteSpan message, uint32_t field_number)
 Scans a serialized protobuf message for a fixed64 field.
 
template<typename T , typename = std::enable_if_t<std::is_enum_v<T>>>
Result< uint64_t > pw::protobuf::FindFixed64 (ConstByteSpan message, T field)
 
Result< uint64_t > pw::protobuf::FindFixed64 (stream::Reader &message_stream, uint32_t field_number)
 Scans a serialized protobuf message for a fixed64 field.
 
template<typename T , typename = std::enable_if_t<std::is_enum_v<T>>>
Result< uint64_t > pw::protobuf::FindFixed64 (stream::Reader &message_stream, T field)
 
Result< int32_t > pw::protobuf::FindSfixed32 (ConstByteSpan message, uint32_t field_number)
 Scans a serialized protobuf message for an sfixed32 field.
 
template<typename T , typename = std::enable_if_t<std::is_enum_v<T>>>
Result< int32_t > pw::protobuf::FindSfixed32 (ConstByteSpan message, T field)
 
Result< int32_t > pw::protobuf::FindSfixed32 (stream::Reader &message_stream, uint32_t field_number)
 Scans a serialized protobuf message for an sfixed32 field.
 
template<typename T , typename = std::enable_if_t<std::is_enum_v<T>>>
Result< int32_t > pw::protobuf::FindSfixed32 (stream::Reader &message_stream, T field)
 
Result< int64_t > pw::protobuf::FindSfixed64 (ConstByteSpan message, uint32_t field_number)
 Scans a serialized protobuf message for an sfixed64 field.
 
template<typename T , typename = std::enable_if_t<std::is_enum_v<T>>>
Result< int64_t > pw::protobuf::FindSfixed64 (ConstByteSpan message, T field)
 
Result< int64_t > pw::protobuf::FindSfixed64 (stream::Reader &message_stream, uint32_t field_number)
 Scans a serialized protobuf message for an sfixed64 field.
 
template<typename T , typename = std::enable_if_t<std::is_enum_v<T>>>
Result< int64_t > pw::protobuf::FindSfixed64 (stream::Reader &message_stream, T field)
 
Result< float > pw::protobuf::FindFloat (ConstByteSpan message, uint32_t field_number)
 Scans a serialized protobuf message for a float field.
 
template<typename T , typename = std::enable_if_t<std::is_enum_v<T>>>
Result< float > pw::protobuf::FindFloat (ConstByteSpan message, T field)
 
Result< float > pw::protobuf::FindFloat (stream::Reader &message_stream, uint32_t field_number)
 Scans a serialized protobuf message for a float field.
 
template<typename T , typename = std::enable_if_t<std::is_enum_v<T>>>
Result< float > pw::protobuf::FindFloat (stream::Reader &message_stream, T field)
 
Result< double > pw::protobuf::FindDouble (ConstByteSpan message, uint32_t field_number)
 Scans a serialized protobuf message for a double field.
 
template<typename T , typename = std::enable_if_t<std::is_enum_v<T>>>
Result< double > pw::protobuf::FindDouble (ConstByteSpan message, T field)
 
Result< double > pw::protobuf::FindDouble (stream::Reader &message_stream, uint32_t field_number)
 Scans a serialized protobuf message for a double field.
 
template<typename T , typename = std::enable_if_t<std::is_enum_v<T>>>
Result< double > pw::protobuf::FindDouble (stream::Reader &message_stream, T field)
 
Result< std::string_view > pw::protobuf::FindString (ConstByteSpan message, uint32_t field_number)
 Scans a serialized protobuf message for a string field.
 
template<typename T , typename = std::enable_if_t<std::is_enum_v<T>>>
Result< std::string_view > pw::protobuf::FindString (ConstByteSpan message, T field)
 
StatusWithSize pw::protobuf::FindString (stream::Reader &message_stream, uint32_t field_number, span< char > out)
 Scans a serialized protobuf message for a stringfield, copying its data into the provided buffer.
 
StatusWithSize pw::protobuf::FindString (stream::Reader &message_stream, uint32_t field_number, InlineString<> &out)
 Scans a serialized protobuf message for a stringfield, copying its data into the provided buffer.
 
template<typename T , typename = std::enable_if_t<std::is_enum_v<T>>>
StatusWithSize pw::protobuf::FindString (stream::Reader &message_stream, T field, span< char > out)
 
template<typename T , typename = std::enable_if_t<std::is_enum_v<T>>>
StatusWithSize pw::protobuf::FindString (stream::Reader &message_stream, T field, InlineString<> &out)
 
Result< ConstByteSpan > pw::protobuf::FindBytes (ConstByteSpan message, uint32_t field_number)
 Scans a serialized protobuf message for a bytes field.
 
template<typename T , typename = std::enable_if_t<std::is_enum_v<T>>>
Result< ConstByteSpan > pw::protobuf::FindBytes (ConstByteSpan message, T field)
 
StatusWithSize pw::protobuf::FindBytes (stream::Reader &message_stream, uint32_t field_number, ByteSpan out)
 Scans a serialized protobuf message for a bytes field, copying its data into the provided buffer.
 
template<typename T , typename = std::enable_if_t<std::is_enum_v<T>>>
StatusWithSize pw::protobuf::FindBytes (stream::Reader &message_stream, T field, ByteSpan out)
 
Result< ConstByteSpan > pw::protobuf::FindSubmessage (ConstByteSpan message, uint32_t field_number)
 Scans a serialized protobuf message for a submessage.
 
template<typename T , typename = std::enable_if_t<std::is_enum_v<T>>>
Result< ConstByteSpan > pw::protobuf::FindSubmessage (ConstByteSpan message, T field)
 
Result< ConstByteSpan > pw::protobuf::FindRaw (ConstByteSpan message, uint32_t field_number)
 Returns a span containing the raw bytes of the value.
 
template<typename T , typename = std::enable_if_t<std::is_enum_v<T>>>
Result< ConstByteSpan > pw::protobuf::FindRaw (ConstByteSpan message, T field)
 

Detailed Description

Sometimes, only a single field from a serialized message needs to be read. In these cases, setting up a decoder and iterating through the message is a lot of boilerplate. pw_protobuf provides convenient Find*() functions which handle this for you.

Note
Each call to Find*() linearly scans through the message. If you have to read multiple fields, it is more efficient to instantiate your own decoder as described above.
pw::Status PrintCustomerAge(pw::ConstByteSpan serialized_customer) {
pw::Result<uint32_t> age = pw::protobuf::FindUint32(
serialized_customer, Customer::Fields::kAge);
if (!age.ok()) {
return age.status();
}
PW_LOG_INFO("Customer's age is %u", *age);
return pw::OkStatus();
}
Definition: status.h:85
constexpr Status OkStatus()
Definition: status.h:234

Function Documentation

◆ FindBool() [1/2]

Result< bool > pw::protobuf::FindBool ( ConstByteSpan  message,
uint32_t  field_number 
)
inline

Scans a serialized protobuf message for a bool field.

Parameters
messageThe serialized message to search.
field_numberProtobuf field number of the field.
Returns
embed:rst:leading-asterisk
 
* 
*  .. pw-status-codes::
* 
*     OK: Returns the field.
* 
*     NOT_FOUND: The field is not present.
* 
*     DATA_LOSS: The serialized message is not a valid protobuf.
* 
*     FAILED_PRECONDITION: The field exists, but is not the correct type.
* 
*  

◆ FindBool() [2/2]

Result< bool > pw::protobuf::FindBool ( stream::Reader message_stream,
uint32_t  field_number 
)
inline

Scans a serialized protobuf message for a bool field.

Parameters
message_streamThe serialized message to search.
field_numberProtobuf field number of the field.
Returns
embed:rst:leading-asterisk
 
* 
*  .. pw-status-codes::
* 
*     OK: Returns the field.
* 
*     NOT_FOUND: The field is not present.
* 
*     DATA_LOSS: The serialized message is not a valid protobuf.
* 
*     FAILED_PRECONDITION: The field exists, but is not the correct type.
* 
*  

◆ FindBytes() [1/2]

Result< ConstByteSpan > pw::protobuf::FindBytes ( ConstByteSpan  message,
uint32_t  field_number 
)
inline

Scans a serialized protobuf message for a bytes field.

Parameters
messageThe serialized message to search.
field_numberProtobuf field number of the field.
Returns
embed:rst:leading-asterisk
 
* 
*  .. pw-status-codes::
* 
*     OK: Returns the subspan of the buffer containing the bytes field.
* 
*     NOT_FOUND: The field is not present.
* 
*     DATA_LOSS: The serialized message is not a valid protobuf.
* 
*     FAILED_PRECONDITION: The field exists, but is not the correct type.
* 
*  

◆ FindBytes() [2/2]

StatusWithSize pw::protobuf::FindBytes ( stream::Reader message_stream,
uint32_t  field_number,
ByteSpan  out 
)
inline

Scans a serialized protobuf message for a bytes field, copying its data into the provided buffer.

Parameters
message_streamThe serialized message to search.
field_numberProtobuf field number of the field.
Returns
embed:rst:leading-asterisk
 
* 
*  .. pw-status-codes::
* 
*     OK: Returns the size of the copied data.
* 
*     NOT_FOUND: The field is not present.
* 
*     DATA_LOSS: The serialized message is not a valid protobuf.
* 
*     FAILED_PRECONDITION: The field exists, but is not the correct type.
* 
*  

◆ FindDouble() [1/2]

Result< double > pw::protobuf::FindDouble ( ConstByteSpan  message,
uint32_t  field_number 
)
inline

Scans a serialized protobuf message for a double field.

Parameters
messageThe serialized message to search.
field_numberProtobuf field number of the field.
Returns
embed:rst:leading-asterisk
 
* 
*  .. pw-status-codes::
* 
*     OK: Returns the field.
* 
*     NOT_FOUND: The field is not present.
* 
*     DATA_LOSS: The serialized message is not a valid protobuf.
* 
*     FAILED_PRECONDITION: The field exists, but is not the correct type.
* 
*  

◆ FindDouble() [2/2]

Result< double > pw::protobuf::FindDouble ( stream::Reader message_stream,
uint32_t  field_number 
)
inline

Scans a serialized protobuf message for a double field.

Parameters
message_streamThe serialized message to search.
field_numberProtobuf field number of the field.
Returns
embed:rst:leading-asterisk
 
* 
*  .. pw-status-codes::
* 
*     OK: Returns the field.
* 
*     NOT_FOUND: The field is not present.
* 
*     DATA_LOSS: The serialized message is not a valid protobuf.
* 
*     FAILED_PRECONDITION: The field exists, but is not the correct type.
* 
*  

◆ FindFixed32() [1/2]

Result< uint32_t > pw::protobuf::FindFixed32 ( ConstByteSpan  message,
uint32_t  field_number 
)
inline

Scans a serialized protobuf message for a fixed32 field.

Parameters
messageThe serialized message to search.
field_numberProtobuf field number of the field.
Returns
embed:rst:leading-asterisk
 
* 
*  .. pw-status-codes::
* 
*     OK: Returns the field.
* 
*     NOT_FOUND: The field is not present.
* 
*     DATA_LOSS: The serialized message is not a valid protobuf.
* 
*     FAILED_PRECONDITION: The field exists, but is not the correct type.
* 
*  

◆ FindFixed32() [2/2]

Result< uint32_t > pw::protobuf::FindFixed32 ( stream::Reader message_stream,
uint32_t  field_number 
)
inline

Scans a serialized protobuf message for a fixed32 field.

Parameters
message_streamThe serialized message to search.
field_numberProtobuf field number of the field.
Returns
embed:rst:leading-asterisk
 
* 
*  .. pw-status-codes::
* 
*     OK: Returns the field.
* 
*     NOT_FOUND: The field is not present.
* 
*     DATA_LOSS: The serialized message is not a valid protobuf.
* 
*     FAILED_PRECONDITION: The field exists, but is not the correct type.
* 
*  

◆ FindFixed64() [1/2]

Result< uint64_t > pw::protobuf::FindFixed64 ( ConstByteSpan  message,
uint32_t  field_number 
)
inline

Scans a serialized protobuf message for a fixed64 field.

Parameters
messageThe serialized message to search.
field_numberProtobuf field number of the field.
Returns
embed:rst:leading-asterisk
 
* 
*  .. pw-status-codes::
* 
*     OK: Returns the field.
* 
*     NOT_FOUND: The field is not present.
* 
*     DATA_LOSS: The serialized message is not a valid protobuf.
* 
*     FAILED_PRECONDITION: The field exists, but is not the correct type.
* 
*  

◆ FindFixed64() [2/2]

Result< uint64_t > pw::protobuf::FindFixed64 ( stream::Reader message_stream,
uint32_t  field_number 
)
inline

Scans a serialized protobuf message for a fixed64 field.

Parameters
message_streamThe serialized message to search.
field_numberProtobuf field number of the field.
Returns
embed:rst:leading-asterisk
 
* 
*  .. pw-status-codes::
* 
*     OK: Returns the field.
* 
*     NOT_FOUND: The field is not present.
* 
*     DATA_LOSS: The serialized message is not a valid protobuf.
* 
*     FAILED_PRECONDITION: The field exists, but is not the correct type.
* 
*  

◆ FindFloat() [1/2]

Result< float > pw::protobuf::FindFloat ( ConstByteSpan  message,
uint32_t  field_number 
)
inline

Scans a serialized protobuf message for a float field.

Parameters
messageThe serialized message to search.
field_numberProtobuf field number of the field.
Returns
embed:rst:leading-asterisk
 
* 
*  .. pw-status-codes::
* 
*     OK: Returns the field.
* 
*     NOT_FOUND: The field is not present.
* 
*     DATA_LOSS: The serialized message is not a valid protobuf.
* 
*     FAILED_PRECONDITION: The field exists, but is not the correct type.
* 
*  

◆ FindFloat() [2/2]

Result< float > pw::protobuf::FindFloat ( stream::Reader message_stream,
uint32_t  field_number 
)
inline

Scans a serialized protobuf message for a float field.

Parameters
message_streamThe serialized message to search.
field_numberProtobuf field number of the field.
Returns
embed:rst:leading-asterisk
 
* 
*  .. pw-status-codes::
* 
*     OK: Returns the field.
* 
*     NOT_FOUND: The field is not present.
* 
*     DATA_LOSS: The serialized message is not a valid protobuf.
* 
*     FAILED_PRECONDITION: The field exists, but is not the correct type.
* 
*  

◆ FindInt32() [1/2]

Result< int32_t > pw::protobuf::FindInt32 ( ConstByteSpan  message,
uint32_t  field_number 
)
inline

Scans a serialized protobuf message for an int32 field.

Parameters
messageThe serialized message to search.
field_numberProtobuf field number of the field.
Returns
embed:rst:leading-asterisk
 
* 
*  .. pw-status-codes::
* 
*     OK: Returns the field.
* 
*     NOT_FOUND: The field is not present.
* 
*     DATA_LOSS: The serialized message is not a valid protobuf.
* 
*     FAILED_PRECONDITION: The field exists, but is not the correct type.
* 
*  

◆ FindInt32() [2/2]

Result< int32_t > pw::protobuf::FindInt32 ( stream::Reader message_stream,
uint32_t  field_number 
)
inline

Scans a serialized protobuf message for an int32 field.

Parameters
message_streamThe serialized message to search.
field_numberProtobuf field number of the field.
Returns
embed:rst:leading-asterisk
 
* 
*  .. pw-status-codes::
* 
*     OK: Returns the field.
* 
*     NOT_FOUND: The field is not present.
* 
*     DATA_LOSS: The serialized message is not a valid protobuf.
* 
*     FAILED_PRECONDITION: The field exists, but is not the correct type.
* 
*  

◆ FindInt64() [1/2]

Result< int64_t > pw::protobuf::FindInt64 ( ConstByteSpan  message,
uint32_t  field_number 
)
inline

Scans a serialized protobuf message for an int64 field.

Parameters
messageThe serialized message to search.
field_numberProtobuf field number of the field.
Returns
embed:rst:leading-asterisk
 
* 
*  .. pw-status-codes::
* 
*     OK: Returns the field.
* 
*     NOT_FOUND: The field is not present.
* 
*     DATA_LOSS: The serialized message is not a valid protobuf.
* 
*     FAILED_PRECONDITION: The field exists, but is not the correct type.
* 
*  

◆ FindInt64() [2/2]

Result< int64_t > pw::protobuf::FindInt64 ( stream::Reader message_stream,
uint32_t  field_number 
)
inline

Scans a serialized protobuf message for an int64 field.

Parameters
message_streamThe serialized message to search.
field_numberProtobuf field number of the field.
Returns
embed:rst:leading-asterisk
 
* 
*  .. pw-status-codes::
* 
*     OK: Returns the field.
* 
*     NOT_FOUND: The field is not present.
* 
*     DATA_LOSS: The serialized message is not a valid protobuf.
* 
*     FAILED_PRECONDITION: The field exists, but is not the correct type.
* 
*  

◆ FindSfixed32() [1/2]

Result< int32_t > pw::protobuf::FindSfixed32 ( ConstByteSpan  message,
uint32_t  field_number 
)
inline

Scans a serialized protobuf message for an sfixed32 field.

Parameters
messageThe serialized message to search.
field_numberProtobuf field number of the field.
Returns
embed:rst:leading-asterisk
 
* 
*  .. pw-status-codes::
* 
*     OK: Returns the field.
* 
*     NOT_FOUND: The field is not present.
* 
*     DATA_LOSS: The serialized message is not a valid protobuf.
* 
*     FAILED_PRECONDITION: The field exists, but is not the correct type.
* 
*  

◆ FindSfixed32() [2/2]

Result< int32_t > pw::protobuf::FindSfixed32 ( stream::Reader message_stream,
uint32_t  field_number 
)
inline

Scans a serialized protobuf message for an sfixed32 field.

Parameters
message_streamThe serialized message to search.
field_numberProtobuf field number of the field.
Returns
embed:rst:leading-asterisk
 
* 
*  .. pw-status-codes::
* 
*     OK: Returns the field.
* 
*     NOT_FOUND: The field is not present.
* 
*     DATA_LOSS: The serialized message is not a valid protobuf.
* 
*     FAILED_PRECONDITION: The field exists, but is not the correct type.
* 
*  

◆ FindSfixed64() [1/2]

Result< int64_t > pw::protobuf::FindSfixed64 ( ConstByteSpan  message,
uint32_t  field_number 
)
inline

Scans a serialized protobuf message for an sfixed64 field.

Parameters
messageThe serialized message to search.
field_numberProtobuf field number of the field.
Returns
embed:rst:leading-asterisk
 
* 
*  .. pw-status-codes::
* 
*     OK: Returns the field.
* 
*     NOT_FOUND: The field is not present.
* 
*     DATA_LOSS: The serialized message is not a valid protobuf.
* 
*     FAILED_PRECONDITION: The field exists, but is not the correct type.
* 
*  

◆ FindSfixed64() [2/2]

Result< int64_t > pw::protobuf::FindSfixed64 ( stream::Reader message_stream,
uint32_t  field_number 
)
inline

Scans a serialized protobuf message for an sfixed64 field.

Parameters
message_streamThe serialized message to search.
field_numberProtobuf field number of the field.
Returns
embed:rst:leading-asterisk
 
* 
*  .. pw-status-codes::
* 
*     OK: Returns the field.
* 
*     NOT_FOUND: The field is not present.
* 
*     DATA_LOSS: The serialized message is not a valid protobuf.
* 
*     FAILED_PRECONDITION: The field exists, but is not the correct type.
* 
*  

◆ FindSint32() [1/2]

Result< int32_t > pw::protobuf::FindSint32 ( ConstByteSpan  message,
uint32_t  field_number 
)
inline

Scans a serialized protobuf message for an sint32 field.

Parameters
messageThe serialized message to search.
field_numberProtobuf field number of the field.
Returns
embed:rst:leading-asterisk
 
* 
*  .. pw-status-codes::
* 
*     OK: Returns the field.
* 
*     NOT_FOUND: The field is not present.
* 
*     DATA_LOSS: The serialized message is not a valid protobuf.
* 
*     FAILED_PRECONDITION: The field exists, but is not the correct type.
* 
*  

◆ FindSint32() [2/2]

Result< int32_t > pw::protobuf::FindSint32 ( stream::Reader message_stream,
uint32_t  field_number 
)
inline

Scans a serialized protobuf message for an sint32 field.

Parameters
message_streamThe serialized message to search.
field_numberProtobuf field number of the field.
Returns
embed:rst:leading-asterisk
 
* 
*  .. pw-status-codes::
* 
*     OK: Returns the field.
* 
*     NOT_FOUND: The field is not present.
* 
*     DATA_LOSS: The serialized message is not a valid protobuf.
* 
*     FAILED_PRECONDITION: The field exists, but is not the correct type.
* 
*  

◆ FindSint64() [1/2]

Result< int64_t > pw::protobuf::FindSint64 ( ConstByteSpan  message,
uint32_t  field_number 
)
inline

Scans a serialized protobuf message for an sint64 field.

Parameters
messageThe serialized message to search.
field_numberProtobuf field number of the field.
Returns
embed:rst:leading-asterisk
 
* 
*  .. pw-status-codes::
* 
*     OK: Returns the field.
* 
*     NOT_FOUND: The field is not present.
* 
*     DATA_LOSS: The serialized message is not a valid protobuf.
* 
*     FAILED_PRECONDITION: The field exists, but is not the correct type.
* 
*  

◆ FindSint64() [2/2]

Result< int64_t > pw::protobuf::FindSint64 ( stream::Reader message_stream,
uint32_t  field_number 
)
inline

Scans a serialized protobuf message for an sint64 field.

Parameters
message_streamThe serialized message to search.
field_numberProtobuf field number of the field.
Returns
embed:rst:leading-asterisk
 
* 
*  .. pw-status-codes::
* 
*     OK: Returns the field.
* 
*     NOT_FOUND: The field is not present.
* 
*     DATA_LOSS: The serialized message is not a valid protobuf.
* 
*     FAILED_PRECONDITION: The field exists, but is not the correct type.
* 
*  

◆ FindString() [1/3]

Result< std::string_view > pw::protobuf::FindString ( ConstByteSpan  message,
uint32_t  field_number 
)
inline

Scans a serialized protobuf message for a string field.

Parameters
messageThe serialized message to search.
field_numberProtobuf field number of the field.
Returns
embed:rst:leading-asterisk
 
* 
*  .. pw-status-codes::
* 
*     OK: Returns a subspan of the buffer containing the string field.
*     **NOTE**: The returned string is NOT null-terminated.
* 
*     NOT_FOUND: The field is not present.
* 
*     DATA_LOSS: The serialized message is not a valid protobuf.
* 
*     FAILED_PRECONDITION: The field exists, but is not the correct type.
* 
*  

◆ FindString() [2/3]

StatusWithSize pw::protobuf::FindString ( stream::Reader message_stream,
uint32_t  field_number,
InlineString<> &  out 
)
inline

Scans a serialized protobuf message for a stringfield, copying its data into the provided buffer.

Parameters
message_streamThe serialized message to search.
field_numberProtobuf field number of the field.
outString to which to write the found value.
Returns
embed:rst:leading-asterisk
 
* 
*  .. pw-status-codes::
* 
*     OK: Returns the size of the copied data.
* 
*     NOT_FOUND: The field is not present.
* 
*     DATA_LOSS: The serialized message is not a valid protobuf.
* 
*     FAILED_PRECONDITION: The field exists, but is not the correct type.
* 
*  

◆ FindString() [3/3]

StatusWithSize pw::protobuf::FindString ( stream::Reader message_stream,
uint32_t  field_number,
span< char >  out 
)
inline

Scans a serialized protobuf message for a stringfield, copying its data into the provided buffer.

Parameters
message_streamThe serialized message to search.
field_numberProtobuf field number of the field.
outThe buffer to which to write the string.
Returns
embed:rst:leading-asterisk
 
* 
*  .. pw-status-codes::
* 
*     OK: Returns the size of the copied data.
*     **NOTE**: The returned string is NOT null-terminated.
* 
*     NOT_FOUND: The field is not present.
* 
*     DATA_LOSS: The serialized message is not a valid protobuf.
* 
*     FAILED_PRECONDITION: The field exists, but is not the correct type.
* 
*  

◆ FindSubmessage()

Result< ConstByteSpan > pw::protobuf::FindSubmessage ( ConstByteSpan  message,
uint32_t  field_number 
)
inline

Scans a serialized protobuf message for a submessage.

Parameters
messageThe serialized message to search.
field_numberProtobuf field number of the field.
Returns
embed:rst:leading-asterisk
 
* 
*  .. pw-status-codes::
* 
*     OK: Returns the subspan of the buffer containing the submessage.
* 
*     NOT_FOUND: The field is not present.
* 
*     DATA_LOSS: The serialized message is not a valid protobuf.
* 
*     FAILED_PRECONDITION: The field exists, but is not the correct type.
* 
*  

◆ FindUint32() [1/2]

Result< uint32_t > pw::protobuf::FindUint32 ( ConstByteSpan  message,
uint32_t  field_number 
)
inline

Scans a serialized protobuf message for a uint32 field.

Parameters
messageThe serialized message to search.
field_numberProtobuf field number of the field.
Returns
embed:rst:leading-asterisk
 
* 
*  .. pw-status-codes::
* 
*     OK: Returns the field.
* 
*     NOT_FOUND: The field is not present.
* 
*     DATA_LOSS: The serialized message is not a valid protobuf.
* 
*     FAILED_PRECONDITION: The field exists, but is not the correct type.
* 
*  

◆ FindUint32() [2/2]

Result< uint32_t > pw::protobuf::FindUint32 ( stream::Reader message_stream,
uint32_t  field_number 
)
inline

Scans a serialized protobuf message for a uint32 field.

Parameters
message_streamThe serialized message to search.
field_numberProtobuf field number of the field.
Returns
embed:rst:leading-asterisk
 
* 
*  .. pw-status-codes::
* 
*     OK: Returns the field.
* 
*     NOT_FOUND: The field is not present.
* 
*     DATA_LOSS: The serialized message is not a valid protobuf.
* 
*     FAILED_PRECONDITION: The field exists, but is not the correct type.
* 
*  

◆ FindUint64() [1/2]

Result< uint64_t > pw::protobuf::FindUint64 ( ConstByteSpan  message,
uint32_t  field_number 
)
inline

Scans a serialized protobuf message for a uint64 field.

Parameters
messageThe serialized message to search.
field_numberProtobuf field number of the field.
Returns
embed:rst:leading-asterisk
 
* 
*  .. pw-status-codes::
* 
*     OK: Returns the field.
* 
*     NOT_FOUND: The field is not present.
* 
*     DATA_LOSS: The serialized message is not a valid protobuf.
* 
*     FAILED_PRECONDITION: The field exists, but is not the correct type.
* 
*  

◆ FindUint64() [2/2]

Result< uint64_t > pw::protobuf::FindUint64 ( stream::Reader message_stream,
uint32_t  field_number 
)
inline

Scans a serialized protobuf message for a uint64 field.

Parameters
message_streamThe serialized message to search.
field_numberProtobuf field number of the field.
Returns
embed:rst:leading-asterisk
 
* 
*  .. pw-status-codes::
* 
*     OK: Returns the field.
* 
*     NOT_FOUND: The field is not present.
* 
*     DATA_LOSS: The serialized message is not a valid protobuf.
* 
*     FAILED_PRECONDITION: The field exists, but is not the correct type.
* 
*