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 use crate::__internal::SealedInternal; 8 use crate::{AsView, IntoView, Proxied, Proxy, ViewProxy}; 9 10 macro_rules! impl_singular_primitives { 11 ($($t:ty),*) => { 12 $( 13 impl SealedInternal for $t {} 14 15 impl Proxied for $t { 16 type View<'msg> = $t; 17 } 18 19 impl<'msg> Proxy<'msg> for $t { 20 } 21 22 impl AsView for $t { 23 type Proxied = $t; 24 25 fn as_view(&self) -> $t { 26 *self 27 } 28 } 29 30 impl<'msg> IntoView<'msg> for $t { 31 fn into_view<'shorter>(self) -> $t 32 where 33 'msg: 'shorter { 34 self 35 } 36 } 37 38 impl<'msg> ViewProxy<'msg> for $t {} 39 40 // ProxiedInRepeated is implemented in {cpp,upb}.rs 41 )* 42 } 43 } 44 45 impl_singular_primitives!(bool, f32, f64, i32, i64, u32, u64); 46