use crate::Reflect;12/// Marks a type as a [reflectable] wrapper for a remote type.3///4/// This allows types from external libraries (remote types) to be included in reflection.5///6/// # Safety7///8/// It is highly recommended to avoid implementing this trait manually and instead use the9/// [`#[reflect_remote]`](crate::reflect_remote) attribute macro.10/// This is because the trait tends to rely on [`transmute`], which is [very unsafe].11///12/// The macro will ensure that the following safety requirements are met:13/// - `Self` is a single-field tuple struct (i.e. a newtype) containing the remote type.14/// - `Self` is `#[repr(transparent)]` over the remote type.15///16/// Additionally, the macro will automatically generate [`Reflect`] and [`FromReflect`] implementations,17/// along with compile-time assertions to validate that the safety requirements have been met.18///19/// # Example20///21/// ```22/// use bevy_reflect_derive::{reflect_remote, Reflect};23///24/// mod some_lib {25/// pub struct TheirType {26/// pub value: u3227/// }28/// }29///30/// #[reflect_remote(some_lib::TheirType)]31/// struct MyType {32/// pub value: u3233/// }34///35/// #[derive(Reflect)]36/// struct MyStruct {37/// #[reflect(remote = MyType)]38/// data: some_lib::TheirType,39/// }40/// ```41///42/// [reflectable]: Reflect43/// [`transmute`]: core::mem::transmute44/// [very unsafe]: https://doc.rust-lang.org/1.71.0/nomicon/transmutes.html45/// [`FromReflect`]: crate::FromReflect46pub trait ReflectRemote: Reflect {47/// The remote type this type represents via reflection.48type Remote;4950/// Converts a reference of this wrapper to a reference of its remote type.51fn as_remote(&self) -> &Self::Remote;52/// Converts a mutable reference of this wrapper to a mutable reference of its remote type.53fn as_remote_mut(&mut self) -> &mut Self::Remote;54/// Converts this wrapper into its remote type.55fn into_remote(self) -> Self::Remote;5657/// Converts a reference of the remote type to a reference of this wrapper.58fn as_wrapper(remote: &Self::Remote) -> &Self;59/// Converts a mutable reference of the remote type to a mutable reference of this wrapper.60fn as_wrapper_mut(remote: &mut Self::Remote) -> &mut Self;61/// Converts the remote type into this wrapper.62fn into_wrapper(remote: Self::Remote) -> Self;63}646566