pub fn from_bytes(
        bytes: &[u8],
        NormalizedProtobufMessageName(message_name): NormalizedProtobufMessageName,
    ) -> Result<Self, anyhow::Error> {
        let fds =
            FileDescriptorSet::parse_from_bytes(bytes).context("parsing file descriptor set")?;
        let fds = FileDescriptor::new_dynamic_fds(fds.file);
        let message_descriptor = fds
            .iter()
            .find_map(|fd| fd.message_by_full_name(&message_name))
            .ok_or_else(|| {
                anyhow!(
                    "protobuf message {} not found in file descriptor set",
                    message_name.quoted(),
                )
            })?;
        let mut seen_messages = HashSet::new();
        seen_messages.insert(message_descriptor.name().to_owned());
        let mut columns = vec![];
        for field in message_descriptor.fields() {
            let name = ColumnName::from(field.get_name());
            let ty = derive_column_type(&mut seen_messages, &field)?;
            columns.push((name, ty))
        }
        Ok(DecodedDescriptors {
            message_descriptor,
            columns,
            message_name: NormalizedProtobufMessageName(message_name),
        })
    }
/// Builds a `DecodedDescriptors` from an encoded [`FileDescriptorSet`]
/// and the fully qualified name of a message inside that file descriptor
/// set.
Builds a `DecodedDescriptors` from an encoded [`FileDescriptorSet`]
and the fully qualified name of a message inside that file descriptor
set.
Builds a ` DecodedDescriptors ` from an encoded [ ` FileDescriptorSet ` ] and the fully qualified name of a message inside that file descriptor set .
pub fn from_bytes(
        bytes: &[u8],
        NormalizedProtobufMessageName(message_name): NormalizedProtobufMessageName,
    ) -> Result<Self, anyhow::Error> {
        let fds =
            FileDescriptorSet::parse_from_bytes(bytes).context("parsing file descriptor set")?;
        let fds = FileDescriptor::new_dynamic_fds(fds.file);
        let message_descriptor = fds
            .iter()
            .find_map(|fd| fd.message_by_full_name(&message_name))
            .ok_or_else(|| {
                anyhow!(
                    "protobuf message {} not found in file descriptor set",
                    message_name.quoted(),
                )
            })?;
        let mut seen_messages = HashSet::new();
        seen_messages.insert(message_descriptor.name().to_owned());
        let mut columns = vec![];
        for field in message_descriptor.fields() {
            let name = ColumnName::from(field.get_name());
            let ty = derive_column_type(&mut seen_messages, &field)?;
            columns.push((name, ty))
        }
        Ok(DecodedDescriptors {
            message_descriptor,
            columns,
            message_name: NormalizedProtobufMessageName(message_name),
        })
    }
pub fn from_bytes ( bytes : & [ u8 ] , NormalizedProtobufMessageName ( message_name ) : NormalizedProtobufMessageName , ) -> Result < Self , anyhow :: Error > { let fds = FileDescriptorSet :: parse_from_bytes ( bytes ) . context ( " " ) ? ; let fds = FileDescriptor :: new_dynamic_fds ( fds . file ) ; let message_descriptor = fds . iter ( ) . find_map ( | fd | fd . message_by_full_name ( & message_name ) ) . ok_or_else ( | | { anyhow ! ( " " message_name quoted ( ) ) } ) ? ; let mut seen_messages = HashSet :: new ( ) ; seen_messages . insert ( message_descriptor . name ( ) . to_owned ( ) ) ; let mut columns = vec ! [ ] ; for field in message_descriptor . fields ( ) { let name = ColumnName :: from ( field . get_name ( ) ) ; let ty = derive_column_type ( & mut seen_messages , & field ) ? ; columns . push ( ( name , ty ) ) } Ok ( DecodedDescriptors { message_descriptor , columns , message_name : NormalizedProtobufMessageName ( message_name ) , } ) }
Builds a `DecodedDescriptors` from an encoded [`FileDescriptorSet`]
and the fully qualified name of a message inside that file descriptor
set.
Builds a ` DecodedDescriptors ` from an encoded [ ` FileDescriptorSet ` ] and the fully qualified name of a message inside that file descriptor set .
bytes
NormalizedProtobufMessageName
bytes
NormalizedProtobufMessageName