包含标签 rust 的文章

rustdoc 范例

1. rust doc /// A human being is represented here pub struct Person { /// A person must have a name, no matter how much Juliet may hate it name: String, } impl Person { /// Returns a person with the name given them /// /// # Arguments /// /// * `name` - A string slice that holds the name of the person /// /// # Example /// /// ``` /// // You can have rust code between fences inside the comments /// // If you pass --test to Rustdoc, it will even test it for you!……

阅读全文

使用rust语言+SDL2库写游戏

1. 安装rust curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh 2. 设置rust国内源 #当前用户目录下 /linuxidc/.cargo/ 的.cargo 文件夹,进入.cargo 当前目录,在当前目下创建 config 文件 source.crates-io] registry = "https://github.com/rust-lang/crates.io-index" replace-with = 'ustc' [source.ustc] registry = "git://mirrors.ustc.edu.cn/crates.io-index" 3. 安装SDL库 dnf install SDL2 dnf install SDL2-devel dnf install SDL2_image-devel dnf install SDL2_gfx-devel dnf install SDL2_mixer-devel dnf install SDL2_ttf-devel 4. 创建rust项目 cargo new testSDL cd testSDL 编辑cargo.toml,加入sdl2依赖 [dongfeng@localhost testSDL]$ cat Cargo.toml [package] name = "testsdl" version = "0.……

阅读全文

最近文章

分类

标签

友情链接

其它