|
|
|
@ -192,7 +192,7 @@ void MessageDrop(Context& ctx, const Descriptor& msg) { |
|
|
|
|
)rs"); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
void MessageSettableValue(Context& ctx, const Descriptor& msg) { |
|
|
|
|
void MessageSettableValueForView(Context& ctx, const Descriptor& msg) { |
|
|
|
|
switch (ctx.opts().kernel) { |
|
|
|
|
case Kernel::kCpp: |
|
|
|
|
ctx.Emit({{"copy_from_thunk", ThunkName(ctx, msg, "copy_from")}}, R"rs( |
|
|
|
@ -519,7 +519,8 @@ void GenerateRs(Context& ctx, const Descriptor& msg) { |
|
|
|
|
AccessorCase::MUT); |
|
|
|
|
} |
|
|
|
|
}}, |
|
|
|
|
{"settable_impl", [&] { MessageSettableValue(ctx, msg); }}, |
|
|
|
|
{"settable_impl_for_view", |
|
|
|
|
[&] { MessageSettableValueForView(ctx, msg); }}, |
|
|
|
|
{"repeated_impl", [&] { MessageProxiedInRepeated(ctx, msg); }}, |
|
|
|
|
{"unwrap_upb", |
|
|
|
|
[&] { |
|
|
|
@ -655,7 +656,18 @@ void GenerateRs(Context& ctx, const Descriptor& msg) { |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
$settable_impl$ |
|
|
|
|
$settable_impl_for_view$ |
|
|
|
|
|
|
|
|
|
impl $pb$::SettableValue<$Msg$> for $Msg$ { |
|
|
|
|
fn set_on<'dst>( |
|
|
|
|
self, _private: $pbi$::Private, mutator: $pb$::Mut<'dst, $Msg$>) |
|
|
|
|
where $Msg$: 'dst { |
|
|
|
|
//~ TODO: b/320701507 - This current will copy the message and then
|
|
|
|
|
//~ drop it, this copy would be avoided on upb kernel.
|
|
|
|
|
self.as_view().set_on($pbi$::Private, mutator); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
$repeated_impl$ |
|
|
|
|
|
|
|
|
|
#[derive(Debug)] |
|
|
|
|