Rename IntoProxied::into -> IntoProxied::into_proxied

`into` is also used by `Into::into`, and these two often clash.

PiperOrigin-RevId: 642584408
pull/17114/head
Marcel Hlopko 6 months ago committed by Copybara-Service
parent 3784ba1959
commit fe6963970c
  1. 2
      rust/proxied.rs
  2. 8
      rust/repeated.rs
  3. 4
      src/google/protobuf/compiler/rust/accessors/repeated_field.cc
  4. 4
      src/google/protobuf/compiler/rust/accessors/singular_message.cc
  5. 18
      src/google/protobuf/compiler/rust/message.cc

@ -217,7 +217,7 @@ where
/// runtime. We expect it to change in backwards incompatible ways in the
/// future.
pub trait IntoProxied<T: Proxied> {
fn into(self, _private: Private) -> T;
fn into_proxied(self, _private: Private) -> T;
}
#[cfg(test)]

@ -241,7 +241,7 @@ impl<T> IntoProxied<Repeated<T>> for Repeated<T>
where
T: ?Sized + ProxiedInRepeated,
{
fn into(self, _private: Private) -> Repeated<T> {
fn into_proxied(self, _private: Private) -> Repeated<T> {
self
}
}
@ -250,7 +250,7 @@ impl<'msg, T> IntoProxied<Repeated<T>> for RepeatedView<'msg, T>
where
T: 'msg + ?Sized + ProxiedInRepeated,
{
fn into(self, _private: Private) -> Repeated<T> {
fn into_proxied(self, _private: Private) -> Repeated<T> {
let mut repeated: Repeated<T> = Repeated::new();
T::repeated_copy_from(self, repeated.as_mut());
repeated
@ -261,8 +261,8 @@ impl<'msg, T> IntoProxied<Repeated<T>> for RepeatedMut<'msg, T>
where
T: 'msg + ?Sized + ProxiedInRepeated,
{
fn into(self, _private: Private) -> Repeated<T> {
IntoProxied::into(self.as_view(), _private)
fn into_proxied(self, _private: Private) -> Repeated<T> {
IntoProxied::into_proxied(self.as_view(), _private)
}
}

@ -119,7 +119,7 @@ void RepeatedField::InMsgImpl(Context& ctx, const FieldDescriptor& field,
$field_number$
)
};
let val = src.into($pbi$::Private);
let val = src.into_proxied($pbi$::Private);
let inner = val.inner($pbi$::Private);
self.arena().fuse(inner.arena());
@ -137,7 +137,7 @@ void RepeatedField::InMsgImpl(Context& ctx, const FieldDescriptor& field,
pub fn set_$raw_field_name$(&mut self, src: impl $pb$::IntoProxied<$pb$::Repeated<$RsType$>>) {
// Prevent the memory from being deallocated. The setter
// transfers ownership of the memory to the parent message.
let val = std::mem::ManuallyDrop::new(src.into($pbi$::Private));
let val = std::mem::ManuallyDrop::new(src.into_proxied($pbi$::Private));
unsafe {
$move_setter_thunk$(self.raw_msg(),
val.inner($pbi$::Private).raw());

@ -116,7 +116,7 @@ void SingularMessage::InMsgImpl(Context& ctx, const FieldDescriptor& field,
// The message and arena are dropped after the setter. The
// memory remains allocated as we fuse the arena with the
// parent message's arena.
let mut msg = val.into($pbi$::Private);
let mut msg = val.into_proxied($pbi$::Private);
self.as_mutator_message_ref($pbi$::Private)
.arena($pbi$::Private)
.fuse(msg.as_mutator_message_ref($pbi$::Private).arena($pbi$::Private));
@ -130,7 +130,7 @@ void SingularMessage::InMsgImpl(Context& ctx, const FieldDescriptor& field,
ctx.Emit({}, R"rs(
// Prevent the memory from being deallocated. The setter
// transfers ownership of the memory to the parent message.
let mut msg = std::mem::ManuallyDrop::new(val.into($pbi$::Private));
let mut msg = std::mem::ManuallyDrop::new(val.into_proxied($pbi$::Private));
unsafe {
$set_allocated_thunk$(self.as_mutator_message_ref($pbi$::Private).msg(),
msg.as_mutator_message_ref($pbi$::Private).msg());

@ -240,7 +240,7 @@ void IntoProxiedForMessage(Context& ctx, const Descriptor& msg) {
case Kernel::kCpp:
ctx.Emit({{"copy_from_thunk", ThunkName(ctx, msg, "copy_from")}}, R"rs(
impl<'msg> $pb$::IntoProxied<$Msg$> for $Msg$View<'msg> {
fn into(self, _private: $pbi$::Private) -> $Msg$ {
fn into_proxied(self, _private: $pbi$::Private) -> $Msg$ {
let dst = $Msg$::new();
unsafe { $copy_from_thunk$(dst.inner.msg, self.msg) };
dst
@ -248,13 +248,13 @@ void IntoProxiedForMessage(Context& ctx, const Descriptor& msg) {
}
impl<'msg> $pb$::IntoProxied<$Msg$> for $Msg$Mut<'msg> {
fn into(self, _private: $pbi$::Private) -> $Msg$ {
$pb$::IntoProxied::into($pb$::ViewProxy::into_view(self), _private)
fn into_proxied(self, _private: $pbi$::Private) -> $Msg$ {
$pb$::IntoProxied::into_proxied($pb$::ViewProxy::into_view(self), _private)
}
}
impl $pb$::IntoProxied<$Msg$> for $Msg$ {
fn into(self, _private: $pbi$::Private) -> $Msg$ {
fn into_proxied(self, _private: $pbi$::Private) -> $Msg$ {
self
}
}
@ -264,7 +264,7 @@ void IntoProxiedForMessage(Context& ctx, const Descriptor& msg) {
case Kernel::kUpb:
ctx.Emit({{"minitable", UpbMinitableName(msg)}}, R"rs(
impl<'msg> $pb$::IntoProxied<$Msg$> for $Msg$View<'msg> {
fn into(self, _private: $pbi$::Private) -> $Msg$ {
fn into_proxied(self, _private: $pbi$::Private) -> $Msg$ {
let dst = $Msg$::new();
unsafe { $pbr$::upb_Message_DeepCopy(
dst.inner.msg,
@ -277,13 +277,13 @@ void IntoProxiedForMessage(Context& ctx, const Descriptor& msg) {
}
impl<'msg> $pb$::IntoProxied<$Msg$> for $Msg$Mut<'msg> {
fn into(self, _private: $pbi$::Private) -> $Msg$ {
$pb$::IntoProxied::into($pb$::ViewProxy::into_view(self), _private)
fn into_proxied(self, _private: $pbi$::Private) -> $Msg$ {
$pb$::IntoProxied::into_proxied($pb$::ViewProxy::into_view(self), _private)
}
}
impl $pb$::IntoProxied<$Msg$> for $Msg$ {
fn into(self, _private: $pbi$::Private) -> $Msg$ {
fn into_proxied(self, _private: $pbi$::Private) -> $Msg$ {
self
}
}
@ -944,7 +944,7 @@ void GenerateRs(Context& ctx, const Descriptor& msg) {
}
pub fn to_owned(&self) -> $Msg$ {
$pb$::IntoProxied::into(*self, $pbi$::Private)
$pb$::IntoProxied::into_proxied(*self, $pbi$::Private)
}
$accessor_fns_for_views$

Loading…
Cancel
Save