Require all Proxied types to be Sized.

This is currently true and required by the IntoProxied trait. In Rust all type parameters are explicitly marked `Sized`, except for `Self` [1]. By marking `Proxied` as `Sized` we can write `IntoProxied<Self>` in generic code without having to add 'where Self: Sized` clauses.

An implication of this change is that Proxied can no longer be used from a trait object i.e. `let x: dyn &Proxied = &foo` will not compile. We are not anticipating such use cases at this point.

[1] https://doc.rust-lang.org/std/marker/trait.Sized.html

PiperOrigin-RevId: 649010900
pull/17310/head
Jakob Buchgraber 7 months ago committed by Copybara-Service
parent 64912c50cb
commit 73db255168
  1. 2
      rust/proxied.rs

@ -52,7 +52,7 @@ use std::fmt::Debug;
/// An instance of a `Proxied` can be accessed immutably via `Proxied::View`.
///
/// All Protobuf field types implement `Proxied`.
pub trait Proxied {
pub trait Proxied: Sized {
/// The proxy type that provides shared access to a `T`, like a `&'msg T`.
///
/// Most code should use the type alias [`View`].

Loading…
Cancel
Save