<?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/cn/tag/number-as/</link><description>多元化原创文章，内容包罗万象，有编程语言、网站应用、软件介绍、硬件介绍、操作系统、旅行游记、专题采访、益智问题、文学创作，以及作者们的知识分享和作品分享。</description><language>zh-CN</language><lastBuildDate>Sun, 22 Nov 2026 18:39:22 +0800</lastBuildDate><atom:link href="https://magiclen.org/cn/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/cn/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/cn/number-as</guid><pubDate>Thu, 1 Nov 2018 20:00:06 +0800</pubDate><dc:creator>Magic Len</dc:creator></item></channel></rss>