proto_types/
lib.rs

1#![cfg_attr(docsrs, feature(doc_auto_cfg))]
2
3//! This crate contains:
4//! 1. Implementations for the google.protobuf well known protobuf types, which are based on the [`prost-types`](https://docs.rs/prost-types/0.14.1/prost_types/) implementation, with the addition of extra methods and impls to help with validation, initialization, serialization, formatting and conversion to [`cel::Value`](::cel::Value).
5//! 2. Implementations for the types provided by the buf.validate protobuf package such as [`protovalidate::Violation`], which are used by protocheck to perform validation.
6
7/// Generated rust code from buf.validate protobuf package, with some added methods and structs.
8pub mod protovalidate;
9
10/// Implementations to allow conversion from well known types to [`cel::Value`](::cel::Value)
11#[cfg(feature = "cel")]
12pub mod cel;
13
14pub use protobuf::*;
15mod protobuf;
16mod protobuf_impls;
17
18/// Implementations and units for Duration structs.
19pub mod duration;
20#[doc(inline)]
21pub use duration::DurationError;
22
23mod timestamp;
24pub use timestamp::*;
25
26mod any;
27mod any_impls;
28
29mod field_mask;
30
31mod field_type;
32#[doc(inline)]
33pub use field_type::FieldType;
34
35mod empty;
36
37mod conversions;
38mod datetime;
39mod type_url;
40
41use core::{convert::TryFrom, fmt, time};
42use std::str::FromStr;
43
44use prost::{
45  alloc::{format, string::String, vec::Vec},
46  DecodeError, EncodeError, Message, Name,
47};
48pub(crate) use type_url::{type_url_for, TypeUrl};
49
50const NANOS_PER_SECOND: i32 = 1_000_000_000;
51
52const NANOS_MAX: i32 = NANOS_PER_SECOND - 1;
53
54const PACKAGE_PREFIX: &str = "google.protobuf";