• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // Protocol Buffers - Google's data interchange format
2 // Copyright 2023 Google LLC.  All rights reserved.
3 //
4 // Use of this source code is governed by a BSD-style
5 // license that can be found in the LICENSE file or at
6 // https://developers.google.com/open-source/licenses/bsd
7 
8 //! Kernel-agnostic logic for the Rust Protobuf runtime that should not be
9 //! exposed to through the `protobuf` path but must be public for use by
10 //! generated code.
11 
12 // Used by the proto! macro
13 pub use paste::paste;
14 
15 pub use crate::r#enum::Enum;
16 pub use crate::ProtoStr;
17 pub use std::fmt::Debug;
18 
19 // TODO: Temporarily re-export these symbols which are now under
20 // __runtime under __internal since some external callers using it through
21 // __internal.
22 pub use crate::__runtime::{PtrAndLen, RawMap, RawMessage, RawRepeatedField};
23 
24 /// Used to protect internal-only items from being used accidentally.
25 #[derive(Debug)]
26 pub struct Private;
27 
28 /// A trait that is used as a subtrait of traits that we intend to be used but
29 /// not be implemented by users.
30 ///
31 /// This is slightly less 'sealed' than the typical sealed trait pattern would
32 /// permit in other crates; this trait is intended to be available to crates
33 /// which were generated by protoc, but not to application code.
34 pub trait SealedInternal {}
35 
36 /// A trait used by the proto_eq() gtest macro.
37 pub trait MatcherEq: SealedInternal + Debug {
matches(&self, o: &Self) -> bool38     fn matches(&self, o: &Self) -> bool;
39 }
40