tring;
}
}</span><pre class='rust rust-example-rendered'>
<span class='kw'>trait</span> <span class='ident'>Foo</span> {
    <span class='kw'>fn</span> <span class='ident'>method</span>(<span class='kw-2'>&amp;</span><span class='self'>self</span>) <span class='op'>-&gt;</span> <span class='ident'>String</span>;
}</pre>

<!-- We’ll also implement this trait for `u8` and `String`: -->

<p>また、このトレイトを <code>u8</code> と <code>String</code> に実装します。</p>

<span class='rusttest