<?xml version="1.0" encoding="utf-8"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"><channel><title>MagicLen</title><link>https://magiclen.org/tag/number-as/</link><description>多元化原創文章，內容包羅萬象，有程式語言、網站應用、軟體介紹、硬體介紹、作業系統、旅行遊記、專題採訪、益智問題、文學創作，以及作者們的知識分享和作品分享。</description><language>zh-TW</language><lastBuildDate>Sun, 29 Nov 2026 04:09:58 +0800</lastBuildDate><atom:link href="https://magiclen.org/tag/number-as/feed/" rel="self" type="application/rss+xml"/><sy:updatePeriod>hourly</sy:updatePeriod><sy:updateFrequency>8</sy:updateFrequency><sy:updateBase>1970-01-01T00:00+00:00</sy:updateBase><item><title>Rust 程式語言的數值型別的相互轉換</title><link>https://magiclen.org/number-as/</link><description><![CDATA[<img src="https://magiclen.org/wp-content/uploads/2018/04/rust-220x162.png" srcset="https://magiclen.org/wp-content/uploads/2018/04/rust-220x162.png 1x, https://magiclen.org/wp-content/uploads/2018/04/rust-440x324.png 2x, https://magiclen.org/wp-content/uploads/2018/04/rust-660x486.png 3x" alt>
Rust 程式語言中並沒有內建一種能夠代表所有基本數值型別（u8, i16, f64 等）的型別，也因此當我們在定義函數或方法的時候，如果要透過參數傳入數值型別的值的話，通常會需要以「fn xxx_u8」、「fn xxx_i16」、「fn xxx_f64」的方式將每個不同的數值型別都獨立定義出來。您可能會想問：為什麼不用泛型？那是因為就算用泛型，我們還是沒有辦法限制泛型的型別參數只能是數值型別。]]></description><category>Rust</category><category>Rust</category><category>number-as</category><guid>https://magiclen.org/number-as</guid><pubDate>Thu, 1 Nov 2018 20:00:06 +0800</pubDate><dc:creator>Magic Len</dc:creator></item></channel></rss>