Trait pprof::protos::Message

source ·
pub trait Message: Debug + Clear + Any + Send + Sync {
Show 28 methods // Required methods fn descriptor(&self) -> &'static MessageDescriptor; fn is_initialized(&self) -> bool; fn merge_from( &mut self, is: &mut CodedInputStream<'_> ) -> Result<(), ProtobufError>; fn write_to_with_cached_sizes( &self, os: &mut CodedOutputStream<'_> ) -> Result<(), ProtobufError>; fn compute_size(&self) -> u32; fn get_cached_size(&self) -> u32; fn get_unknown_fields<'s>(&'s self) -> &'s UnknownFields; fn mut_unknown_fields<'s>(&'s mut self) -> &'s mut UnknownFields; fn as_any(&self) -> &(dyn Any + 'static); fn new() -> Self where Self: Sized; fn default_instance() -> &'static Self where Self: Sized; // Provided methods fn parse_from(is: &mut CodedInputStream<'_>) -> Result<Self, ProtobufError> where Self: Sized { ... } fn write_to( &self, os: &mut CodedOutputStream<'_> ) -> Result<(), ProtobufError> { ... } fn write_length_delimited_to( &self, os: &mut CodedOutputStream<'_> ) -> Result<(), ProtobufError> { ... } fn write_length_delimited_to_vec( &self, vec: &mut Vec<u8, Global> ) -> Result<(), ProtobufError> { ... } fn merge_from_bytes(&mut self, bytes: &[u8]) -> Result<(), ProtobufError> { ... } fn parse_from_reader(reader: &mut dyn Read) -> Result<Self, ProtobufError> where Self: Sized { ... } fn parse_from_bytes(bytes: &[u8]) -> Result<Self, ProtobufError> where Self: Sized { ... } fn check_initialized(&self) -> Result<(), ProtobufError> { ... } fn write_to_writer(&self, w: &mut dyn Write) -> Result<(), ProtobufError> { ... } fn write_to_vec(&self, v: &mut Vec<u8, Global>) -> Result<(), ProtobufError> { ... } fn write_to_bytes(&self) -> Result<Vec<u8, Global>, ProtobufError> { ... } fn write_length_delimited_to_writer( &self, w: &mut dyn Write ) -> Result<(), ProtobufError> { ... } fn write_length_delimited_to_bytes( &self ) -> Result<Vec<u8, Global>, ProtobufError> { ... } fn type_id(&self) -> TypeId { ... } fn as_any_mut(&mut self) -> &mut (dyn Any + 'static) { ... } fn into_any(self: Box<Self, Global>) -> Box<dyn Any, Global> { ... } fn descriptor_static() -> &'static MessageDescriptor where Self: Sized { ... }
}
Expand description

Trait implemented for all generated structs for protobuf messages.

Also, generated messages implement Clone + Default + PartialEq

Required Methods§

source

fn descriptor(&self) -> &'static MessageDescriptor

Message descriptor for this message, used for reflection.

source

fn is_initialized(&self) -> bool

True iff all required fields are initialized. Always returns true for protobuf 3.

source

fn merge_from( &mut self, is: &mut CodedInputStream<'_> ) -> Result<(), ProtobufError>

Update this message object with fields read from given stream.

source

fn write_to_with_cached_sizes( &self, os: &mut CodedOutputStream<'_> ) -> Result<(), ProtobufError>

Write message to the stream.

Sizes of this messages and nested messages must be cached by calling compute_size prior to this call.

source

fn compute_size(&self) -> u32

Compute and cache size of this message and all nested messages

source

fn get_cached_size(&self) -> u32

Get size previously computed by compute_size.

source

fn get_unknown_fields<'s>(&'s self) -> &'s UnknownFields

Get a reference to unknown fields.

source

fn mut_unknown_fields<'s>(&'s mut self) -> &'s mut UnknownFields

Get a mutable reference to unknown fields.

source

fn as_any(&self) -> &(dyn Any + 'static)

View self as Any.

source

fn new() -> Selfwhere Self: Sized,

Create an empty message object.

let m = MyMessage::new();
source

fn default_instance() -> &'static Selfwhere Self: Sized,

Return a pointer to default immutable message with static lifetime.

let m: &MyMessage = MyMessage::default_instance();

Provided Methods§

source

fn parse_from(is: &mut CodedInputStream<'_>) -> Result<Self, ProtobufError>where Self: Sized,

Parse message from stream.

source

fn write_to(&self, os: &mut CodedOutputStream<'_>) -> Result<(), ProtobufError>

Write the message to the stream.

Results in error if message is not fully initialized.

source

fn write_length_delimited_to( &self, os: &mut CodedOutputStream<'_> ) -> Result<(), ProtobufError>

Write the message to the stream prepending the message with message length encoded as varint.

source

fn write_length_delimited_to_vec( &self, vec: &mut Vec<u8, Global> ) -> Result<(), ProtobufError>

Write the message to the vec, prepend the message with message length encoded as varint.

source

fn merge_from_bytes(&mut self, bytes: &[u8]) -> Result<(), ProtobufError>

Update this message object with fields read from given stream.

source

fn parse_from_reader(reader: &mut dyn Read) -> Result<Self, ProtobufError>where Self: Sized,

Parse message from reader. Parse stops on EOF or when error encountered.

source

fn parse_from_bytes(bytes: &[u8]) -> Result<Self, ProtobufError>where Self: Sized,

Parse message from byte array.

source

fn check_initialized(&self) -> Result<(), ProtobufError>

Check if all required fields of this object are initialized.

source

fn write_to_writer(&self, w: &mut dyn Write) -> Result<(), ProtobufError>

Write the message to the writer.

source

fn write_to_vec(&self, v: &mut Vec<u8, Global>) -> Result<(), ProtobufError>

Write the message to bytes vec.

source

fn write_to_bytes(&self) -> Result<Vec<u8, Global>, ProtobufError>

Write the message to bytes vec.

source

fn write_length_delimited_to_writer( &self, w: &mut dyn Write ) -> Result<(), ProtobufError>

Write the message to the writer, prepend the message with message length encoded as varint.

source

fn write_length_delimited_to_bytes( &self ) -> Result<Vec<u8, Global>, ProtobufError>

Write the message to the bytes vec, prepend the message with message length encoded as varint.

source

fn type_id(&self) -> TypeId

Get type id for downcasting.

source

fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)

View self as mutable Any.

source

fn into_any(self: Box<Self, Global>) -> Box<dyn Any, Global>

Convert boxed self to boxed Any.

source

fn descriptor_static() -> &'static MessageDescriptorwhere Self: Sized,

Get message descriptor for message type.

let descriptor = MyMessage::descriptor_static();
assert_eq!("MyMessage", descriptor.name());

Implementors§

source§

impl Message for DescriptorProto

source§

impl Message for DescriptorProto_ExtensionRange

source§

impl Message for DescriptorProto_ReservedRange

source§

impl Message for EnumDescriptorProto

source§

impl Message for EnumDescriptorProto_EnumReservedRange

source§

impl Message for EnumOptions

source§

impl Message for EnumValueDescriptorProto

source§

impl Message for EnumValueOptions

source§

impl Message for ExtensionRangeOptions

source§

impl Message for FieldDescriptorProto

source§

impl Message for FieldOptions

source§

impl Message for FileDescriptorProto

source§

impl Message for FileDescriptorSet

source§

impl Message for FileOptions

source§

impl Message for GeneratedCodeInfo

source§

impl Message for GeneratedCodeInfo_Annotation

source§

impl Message for MessageOptions

source§

impl Message for MethodDescriptorProto

source§

impl Message for MethodOptions

source§

impl Message for OneofDescriptorProto

source§

impl Message for OneofOptions

source§

impl Message for ServiceDescriptorProto

source§

impl Message for ServiceOptions

source§

impl Message for SourceCodeInfo

source§

impl Message for SourceCodeInfo_Location

source§

impl Message for UninterpretedOption

source§

impl Message for UninterpretedOption_NamePart

source§

impl Message for CodeGeneratorRequest

source§

impl Message for CodeGeneratorResponse

source§

impl Message for CodeGeneratorResponse_File

source§

impl Message for Version

source§

impl Message for Any

source§

impl Message for Api

source§

impl Message for Method

source§

impl Message for Mixin

source§

impl Message for Duration

source§

impl Message for Empty

source§

impl Message for FieldMask

source§

impl Message for SourceContext

source§

impl Message for ListValue

source§

impl Message for Struct

source§

impl Message for Value

source§

impl Message for Timestamp

source§

impl Message for Enum

source§

impl Message for EnumValue

source§

impl Message for Field

source§

impl Message for Option

source§

impl Message for Type

source§

impl Message for BoolValue

source§

impl Message for BytesValue

source§

impl Message for DoubleValue

source§

impl Message for FloatValue

source§

impl Message for Int32Value

source§

impl Message for Int64Value

source§

impl Message for StringValue

source§

impl Message for UInt32Value

source§

impl Message for UInt64Value

source§

impl Message for Function

source§

impl Message for Label

source§

impl Message for Line

source§

impl Message for Location

source§

impl Message for Mapping

source§

impl Message for Profile

source§

impl Message for Sample

source§

impl Message for ValueType