This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use std::io::Write; | |
fn main() { // メイン処理 --- (*1) | |
let data = make_bitmap(8, 8); // 画像を作成 | |
let mut f = std::fs::File::create("test.bmp").unwrap(); // ファイル生成 | |
f.write(&data).unwrap(); // ファイルに書き出す | |
println!("画像を書き出しました。"); | |
} | |
// ビットマップ画像データを作成する --- (*2) | |
fn make_bitmap(width: u32, height: u32) -> Vec<u8> { | |
let mut data = vec![]; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Show hidden characters
/** | |
* 果物の商品データをJSONCで記述したもの | |
* JSONCのサンプル | |
*/ | |
[ | |
// マンゴー | |
{"名称": "沖縄マンゴー", "値段": 3240, "産地": "沖縄"}, | |
// ミカン | |
{"名称": "愛媛ミカン", "値段": 3200, "産地": "愛媛"}, | |
// 梨 |