31 releases

0.13.3 Sep 21, 2024
0.13.1 Jul 9, 2024
0.12.3 Nov 21, 2023
0.11.9 Apr 12, 2023
0.2.3 Nov 9, 2017

#192 in Encoding

Download history 1084380/week @ 2024-07-25 1080794/week @ 2024-08-01 1197872/week @ 2024-08-08 1165236/week @ 2024-08-15 1251285/week @ 2024-08-22 1151092/week @ 2024-08-29 1289826/week @ 2024-09-05 1229038/week @ 2024-09-12 1242292/week @ 2024-09-19 1353312/week @ 2024-09-26 1331200/week @ 2024-10-03 1375310/week @ 2024-10-10 1432446/week @ 2024-10-17 1375028/week @ 2024-10-24 1314148/week @ 2024-10-31 1341246/week @ 2024-11-07

5,769,208 downloads per month
Used in 3,041 crates (1,023 directly)

Apache-2.0

275KB
4.5K SLoC

Documentation Crate

prost-types

Prost definitions of Protocol Buffers well known types. See the Protobuf reference for more information about well known types.

License

prost-types is distributed under the terms of the Apache License (Version 2.0). prost-types includes code imported from the Protocol Buffers projet, which is included under its original (BSD) license.

See LICENSE for details.

Copyright 2017 Dan Burkert


lib.rs:

Protocol Buffers well-known types.

Note that the documentation for the types defined in this crate are generated from the Protobuf definitions, so code examples are not in Rust.

See the Protobuf reference for more information about well-known types.

Any

The well-known [Any] type contains an arbitrary serialized message along with a URL that describes the type of the serialized message. Every message that also implements Name can be serialized to and deserialized from [Any].

Serialization

A message can be serialized using Any::from_msg.

let message = Timestamp::date(2000, 1, 1).unwrap();
let any = Any::from_msg(&message).unwrap();

Deserialization

A message can be deserialized using Any::to_msg.

#
let message = any.to_msg::<Timestamp>().unwrap();

Feature Flags

  • std: Enable integration with standard library. Disable this feature for no_std support. This feature is enabled by default.

Dependencies

~175KB