<?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>今回のソースコード struct A { val: i32, } fn main() { let mut a_list: Vec&lt;A&gt; = vec![]; for i in 1..10 { a_list.push(A { val: i }); } let mut inner_elem = &amp;A { val: 0 }; for a in a_list { match a.val { 3 =&gt; inner_elem = &amp;a, _ =&gt; {} } } println!(&quot;{}&quot;, inner_elem.val); } 上記のようにベクタ型変数の要素をループの中で借用してループのスコープの外の変数に…</description>
  <height>190</height>
  <html>&lt;iframe src=&quot;https://hatenablog-parts.com/embed?url=https%3A%2F%2Fbamch0h.hatenablog.com%2Fentry%2F2022%2F09%2F11%2F014320&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-09-11 01:43:20</published>
  <title> ベクタ型内の要素をループ内で借用してループの外で使う場合はベクタ変数を借用してループを回そう</title>
  <type>rich</type>
  <url>https://bamch0h.hatenablog.com/entry/2022/09/11/014320</url>
  <version>1.0</version>
  <width>100%</width>
</oembed>
