Move the declaration of the upb map begin constant into rust

PiperOrigin-RevId: 656463679
pull/17629/head
Derek Benson 7 months ago committed by Copybara-Service
parent 0fbba32b3e
commit 1e1bf0d1fc
  1. 3
      rust/upb.rs
  2. 2
      rust/upb/lib.rs
  3. 4
      rust/upb/map.rs
  4. 2
      rust/upb/upb_api.c

@ -682,8 +682,7 @@ pub struct RawMapIter {
impl RawMapIter {
pub fn new(_private: Private, map: RawMap) -> Self {
// SAFETY: __rust_proto_kUpb_Map_Begin is never modified
RawMapIter { map, iter: unsafe { __rust_proto_kUpb_Map_Begin } }
RawMapIter { map, iter: UPB_MAP_BEGIN }
}
/// # Safety

@ -27,7 +27,7 @@ pub use extension_registry::{upb_ExtensionRegistry, RawExtensionRegistry};
mod map;
pub use map::{
upb_Map, upb_Map_Clear, upb_Map_Delete, upb_Map_Get, upb_Map_Insert, upb_Map_New, upb_Map_Next,
upb_Map_Size, MapInsertStatus, RawMap, __rust_proto_kUpb_Map_Begin,
upb_Map_Size, MapInsertStatus, RawMap, UPB_MAP_BEGIN,
};
mod message;

@ -21,9 +21,9 @@ pub enum MapInsertStatus {
OutOfMemory = 2,
}
extern "C" {
pub static __rust_proto_kUpb_Map_Begin: usize;
pub const UPB_MAP_BEGIN: usize = usize::MAX;
extern "C" {
pub fn upb_Map_New(arena: RawArena, key_type: CType, value_type: CType) -> RawMap;
pub fn upb_Map_Size(map: RawMap) -> usize;
pub fn upb_Map_Insert(

@ -21,5 +21,3 @@
#include "upb/mini_table/message.h" // IWYU pragma: keep
#include "upb/text/debug_string.h" // IWYU pragma: keep
// go/keep-sorted end
const size_t __rust_proto_kUpb_Map_Begin = kUpb_Map_Begin;

Loading…
Cancel
Save