<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<oembed>
  <author_name>Naotsugu</author_name>
  <author_url>https://blog.hatena.ne.jp/Naotsugu/</author_url>
  <blog_title>A Memorandum</blog_title>
  <blog_url>https://blog1.mammb.com/</blog_url>
  <categories>
  </categories>
  <description>LazyCell LazyLock LazyCell と LazyLock は遅延初期化を提供する構造体で、Rust 1.80.0 で安定版となった。 LazyLock はスレッドセーフであり、static 変数を遅延初期化できる。 LazyCell LazyCell は初回アクセス時に指定された関数 F で値を初期化し、それ以降は初期化済みの値を利用できる。 以下のような構造体として提供されている。 pub struct LazyCell&lt;T, F = fn() -&gt; T&gt; { state: UnsafeCell&lt;State&lt;T, F&gt;&gt;, } 単純に 3 で遅延初期化する例としては以下のよ…</description>
  <height>190</height>
  <html>&lt;iframe src=&quot;https://hatenablog-parts.com/embed?url=https%3A%2F%2Fblog1.mammb.com%2Fentry%2F2024%2F07%2F30%2F000000&quot; title=&quot;【Rust】遅延初期化を行う LazyCell と LazyLock - A Memorandum&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>2024-07-30 00:00:00</published>
  <title>【Rust】遅延初期化を行う LazyCell と LazyLock</title>
  <type>rich</type>
  <url>https://blog1.mammb.com/entry/2024/07/30/000000</url>
  <version>1.0</version>
  <width>100%</width>
</oembed>
