<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<oembed>
  <author_name>bamch0h</author_name>
  <author_url>https://blog.hatena.ne.jp/bamch0h/</author_url>
  <blog_title>bamchoh’s diary</blog_title>
  <blog_url>https://bamch0h.hatenablog.com/</blog_url>
  <categories>
    <anon>Rust</anon>
  </categories>
  <description>Boxでくくって、dyn キーワードをつけるのがミソ trait Animal { fn cry(&amp;self); } struct Dog {} impl Animal for Dog { fn cry(&amp;self) { println!(&quot;ワン&quot;); } } struct Cat {} impl Animal for Cat { fn cry(&amp;self) { println!(&quot;にゃん&quot;); } } fn new_animal(animal: &amp;str) -&gt; Box&lt;dyn Animal&gt; { if animal == &quot;Dog&quot; { Box::new(Dog{}) } else { B…</description>
  <height>190</height>
  <html>&lt;iframe src=&quot;https://hatenablog-parts.com/embed?url=https%3A%2F%2Fbamch0h.hatenablog.com%2Fentry%2F2022%2F10%2F06%2F230801&quot; title=&quot; トレイトオブジェクトを返す関数の作成 - bamchoh’s diary&quot; class=&quot;embed-card embed-blogcard&quot; scrolling=&quot;no&quot; frameborder=&quot;0&quot; style=&quot;display: block; width: 100%; height: 190px; max-width: 500px; margin: 10px 0px;&quot;&gt;&lt;/iframe&gt;</html>
  <image_url></image_url>
  <provider_name>Hatena Blog</provider_name>
  <provider_url>https://hatena.blog</provider_url>
  <published>2022-10-06 23:08:01</published>
  <title> トレイトオブジェクトを返す関数の作成</title>
  <type>rich</type>
  <url>https://bamch0h.hatenablog.com/entry/2022/10/06/230801</url>
  <version>1.0</version>
  <width>100%</width>
</oembed>
