<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<oembed>
  <author_name>vaaaaaanquish</author_name>
  <author_url>https://blog.hatena.ne.jp/vaaaaaanquish/</author_url>
  <blog_title>Stimulator</blog_title>
  <blog_url>https://vaaaaaanquish.hatenablog.com/</blog_url>
  <categories>
    <anon>Rust</anon>
    <anon>スクリプト</anon>
  </categories>
  <description>はじめに RustでCLIツールを作る際にターミナル等のwindow size変更に応じて表示を変更したい場合がある。その際に画面サイズの取得について調査したログ。 はじめに 画面サイズの取得 調査ログ 画面サイズの取得 画面サイズの取得には、libcのioctlを利用し、TIOCGWINSZをシステムコールする。 Cargo.tomlにはlibcを追記する。 [dependencies] libc = &quot;0.2&quot; ioctlにはファイルディスクリプタを渡す必要があり、libc::STDOUT_FILENOが使えるが、アプリケーション側にSIGWINCHが上手く送られない場合（CLIツール等を…</description>
  <height>190</height>
  <html>&lt;iframe src=&quot;https://hatenablog-parts.com/embed?url=https%3A%2F%2Fvaaaaaanquish.hatenablog.com%2Fentry%2F2020%2F03%2F23%2F003058&quot; title=&quot;Rustでterminalのwindow sizeを取得する - Stimulator&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>https://cdn-ak.f.st-hatena.com/images/fotolife/v/vaaaaaanquish/20200323/20200323000859.gif</image_url>
  <provider_name>Hatena Blog</provider_name>
  <provider_url>https://hatena.blog</provider_url>
  <published>2020-03-23 00:30:58</published>
  <title>Rustでterminalのwindow sizeを取得する</title>
  <type>rich</type>
  <url>https://vaaaaaanquish.hatenablog.com/entry/2020/03/23/003058</url>
  <version>1.0</version>
  <width>100%</width>
</oembed>
