25 lines
6.6 KiB
HTML
25 lines
6.6 KiB
HTML
<!DOCTYPE html><html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width, initial-scale=1.0"><meta name="generator" content="rustdoc"><meta name="description" content="A catch-all trait that is bound by the core reflection traits, useful to simplify reflection-based generic type bounds."><title>Reflectable in bevy_reflect - Rust</title><script>if(window.location.protocol!=="file:")document.head.insertAdjacentHTML("beforeend","SourceSerif4-Regular-6b053e98.ttf.woff2,FiraSans-Regular-0fe48ade.woff2,FiraSans-Medium-e1aa3f0a.woff2,SourceCodePro-Regular-8badfe75.ttf.woff2,SourceCodePro-Semibold-aa29a496.ttf.woff2".split(",").map(f=>`<link rel="preload" as="font" type="font/woff2" crossorigin href="../static.files/${f}">`).join(""))</script><link rel="stylesheet" href="../static.files/normalize-9960930a.css"><link rel="stylesheet" href="../static.files/rustdoc-42caa33d.css"><meta name="rustdoc-vars" data-root-path="../" data-static-root-path="../static.files/" data-current-crate="bevy_reflect" data-themes="" data-resource-suffix="" data-rustdoc-version="1.84.0 (9fc6b4312 2025-01-07)" data-channel="1.84.0" data-search-js="search-92e6798f.js" data-settings-js="settings-0f613d39.js" ><script src="../static.files/storage-59e33391.js"></script><script defer src="sidebar-items.js"></script><script defer src="../static.files/main-5f194d8c.js"></script><noscript><link rel="stylesheet" href="../static.files/noscript-893ab5e7.css"></noscript><link rel="icon" href="https://bevyengine.org/assets/icon.png"></head><body class="rustdoc trait"><!--[if lte IE 11]><div class="warning">This old browser is unsupported and will most likely display funky things.</div><![endif]--><nav class="mobile-topbar"><button class="sidebar-menu-toggle" title="show sidebar"></button><a class="logo-container" href="../bevy_reflect/index.html"><img src="https://bevyengine.org/assets/icon.png" alt=""></a></nav><nav class="sidebar"><div class="sidebar-crate"><a class="logo-container" href="../bevy_reflect/index.html"><img src="https://bevyengine.org/assets/icon.png" alt="logo"></a><h2><a href="../bevy_reflect/index.html">bevy_<wbr>reflect</a><span class="version">0.15.1</span></h2></div><div class="sidebar-elems"><section id="rustdoc-toc"><h2 class="location"><a href="#">Reflectable</a></h2><h3><a href="#">Sections</a></h3><ul class="block top-toc"><li><a href="#example" title="Example">Example</a></li></ul><h3><a href="#dyn-compatibility">Dyn Compatibility</a></h3><h3><a href="#implementors">Implementors</a></h3></section><div id="rustdoc-modnav"><h2 class="in-crate"><a href="index.html">In crate bevy_<wbr>reflect</a></h2></div></div></nav><div class="sidebar-resizer"></div><main><div class="width-limiter"><rustdoc-search></rustdoc-search><section id="main-content" class="content"><div class="main-heading"><span class="rustdoc-breadcrumbs"><a href="index.html">bevy_reflect</a></span><h1>Trait <span class="trait">Reflectable</span><button id="copy-path" title="Copy item path to clipboard">Copy item path</button></h1><rustdoc-toolbar></rustdoc-toolbar><span class="sub-heading"><a class="src" href="../src/bevy_reflect/reflectable.rs.html#31">Source</a> </span></div><pre class="rust item-decl"><code>pub trait Reflectable:
|
|
<a class="trait" href="trait.Reflect.html" title="trait bevy_reflect::Reflect">Reflect</a>
|
|
+ <a class="trait" href="trait.GetTypeRegistration.html" title="trait bevy_reflect::GetTypeRegistration">GetTypeRegistration</a>
|
|
+ <a class="trait" href="trait.Typed.html" title="trait bevy_reflect::Typed">Typed</a>
|
|
+ <a class="trait" href="trait.TypePath.html" title="trait bevy_reflect::TypePath">TypePath</a> { }</code></pre><details class="toggle top-doc" open><summary class="hideme"><span>Expand description</span></summary><div class="docblock"><p>A catch-all trait that is bound by the core reflection traits,
|
|
useful to simplify reflection-based generic type bounds.</p>
|
|
<p>You do <em>not</em> need to implement this trait manually.
|
|
It is automatically implemented for all types that implement its supertraits.
|
|
And these supertraits are all automatically derived with the <a href="derive.Reflect.html" title="derive bevy_reflect::Reflect"><code>Reflect</code> derive macro</a>.</p>
|
|
<p>This should namely be used to bound generic arguments to the necessary traits for reflection.
|
|
Doing this has the added benefit of reducing migration costs, as a change to the required traits
|
|
is automatically handled by this trait.</p>
|
|
<p>For now, the supertraits of this trait includes:</p>
|
|
<ul>
|
|
<li><a href="trait.Reflect.html" title="trait bevy_reflect::Reflect"><code>Reflect</code></a></li>
|
|
<li><a href="trait.GetTypeRegistration.html" title="trait bevy_reflect::GetTypeRegistration"><code>GetTypeRegistration</code></a></li>
|
|
<li><a href="trait.Typed.html" title="trait bevy_reflect::Typed"><code>Typed</code></a></li>
|
|
<li><a href="trait.TypePath.html" title="trait bevy_reflect::TypePath"><code>TypePath</code></a></li>
|
|
</ul>
|
|
<h3 id="example"><a class="doc-anchor" href="#example">§</a>Example</h3>
|
|
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="attr">#[derive(Reflect)]
|
|
</span><span class="kw">struct </span>MyStruct<T: Reflectable> {
|
|
value: T
|
|
}</code></pre></div>
|
|
</div></details><h2 id="dyn-compatibility" class="section-header">Dyn Compatibility<a href="#dyn-compatibility" class="anchor">§</a></h2><div class="dyn-compatibility-info"><p>This trait is <b>not</b> <a href="https://doc.rust-lang.org/1.84.0/reference/items/traits.html#object-safety">dyn compatible</a>.</p><p><i>In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.</i></p></div><h2 id="implementors" class="section-header">Implementors<a href="#implementors" class="anchor">§</a></h2><div id="implementors-list"><section id="impl-Reflectable-for-T" class="impl"><a class="src rightside" href="../src/bevy_reflect/reflectable.rs.html#33">Source</a><a href="#impl-Reflectable-for-T" class="anchor">§</a><h3 class="code-header">impl<T: <a class="trait" href="trait.Reflect.html" title="trait bevy_reflect::Reflect">Reflect</a> + <a class="trait" href="trait.GetTypeRegistration.html" title="trait bevy_reflect::GetTypeRegistration">GetTypeRegistration</a> + <a class="trait" href="trait.Typed.html" title="trait bevy_reflect::Typed">Typed</a> + <a class="trait" href="trait.TypePath.html" title="trait bevy_reflect::TypePath">TypePath</a>> <a class="trait" href="trait.Reflectable.html" title="trait bevy_reflect::Reflectable">Reflectable</a> for T</h3></section></div><script src="../trait.impl/bevy_reflect/reflectable/trait.Reflectable.js" async></script></section></div></main></body></html> |