Skip to content

Support for ScalarList in protobuf::text_format #760

@tardyp

Description

@tardyp

Now textformat has a spec, we know that ScalarList is official.

ScalarList   = "[", [ ScalarValue,  { ",", ScalarValue  } ], "]" ;

rust-protobuf unfortunately do not support it.

This issue to track the support.

my test:

use protobuf::text_format;
use protos::example::Person;

mod protos;

fn main() {
    const TEXT: &str = "name: \"Alice\" age: 30 array: [1, 2, 3]";
    let person: Person =
    text_format::parse_from_str(TEXT).unwrap();
    println!("{:?}", person);
}

with example.proto:

syntax = "proto3";

message Person {
  string name = 1;
  int32 age = 2;
  repeated int32 array = 3;
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions