- Rust Programming By Example
- Guillaume Gomez Antoni Boucher
- 200字
- 2021-07-02 19:13:06
Playing with features
By default, you can't use the image module with sdl2, we need to activate it. To do so, we need to update our Cargo.toml file by adding a new section as follows:
[features] default = ["sdl2/image"]
default means that by default, the following features ("sdl2/image") will be enabled. Now, let's explain what "sdl2/image" means; sdl2 refers to the crate where we want to enable a feature and image is the feature we want to enable.
Of course, if you want to enable a feature on the current project, you don't need the sdl2/ part. Consider the following example:
[features] network = [] default = ["network"]
As I am sure you understood, it's absolutely possible to chain features activation and even to activate multiple features at once! If you want to enable features depending on a version number, for example:
[features] network_v1 = [] network_v2 = ["network_v1"] network_v3 = ["network_v2"] v1 = ["network_v1"] v2 = ["v1", "network_v2"] v3 = ["v2", "network_v3"]
So if you enable the v3 feature, all the others will be activated as well! It can be incredibly useful when you need to handle multiple versions at once.
Now let's go back to our images.
- 科學(xué)普及組織活動(dòng)讀本
- 圖書館學(xué)是什么
- 文獻(xiàn)保護(hù)中英雙解詞語手冊
- 網(wǎng)絡(luò)學(xué)術(shù)信息老化及應(yīng)對管理
- 醫(yī)學(xué)文獻(xiàn)管理
- 圖書館知識整合與知識服務(wù)研究:以西部社會(huì)科學(xué)院圖書館為例
- 非物質(zhì)文化遺產(chǎn)數(shù)字化研究
- 高校圖書館閱讀推廣與宣傳促進(jìn)研究
- 《葉赫那拉氏族譜》整理與研究
- 大數(shù)據(jù)環(huán)境下高校圖書館知識服務(wù)模式研究
- 校勘學(xué)釋例(中國文化叢書·經(jīng)典隨行)
- 春華集:中華書局員工文選(2019年)
- 計(jì)算社會(huì)學(xué)
- 浩蕩游絲:何焯與清代的批校文化(精裝)
- 金開誠文選