-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
73 additions
and
0 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
[package] | ||
name = "template-rs" | ||
authors = ["29 <[email protected]>"] | ||
version = "0.0.1" | ||
license = "MIT/Apache-2.0" | ||
readme = "README.md" | ||
keywords = ["template"] | ||
categories = ["multimedia::audio"] | ||
repository = "https://github.com/opensound-org/template-rs" | ||
homepage = "https://github.com/opensound-org/template-rs" | ||
description = """ | ||
Template for Rust repositories used by `opensound-org`. | ||
""" | ||
edition = "2021" | ||
|
||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html | ||
|
||
# Because we used `rustc-check-cfg` in build script | ||
# 因为我们在构建脚本中使用了`rustc-check-cfg` | ||
# https://blog.rust-lang.org/2024/05/06/check-cfg.html | ||
rust-version = "1.80.0" | ||
|
||
[package.metadata.docs.rs] | ||
all-features = true | ||
|
||
[dependencies] | ||
|
||
[build-dependencies] | ||
version_check = "0.9.5" |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
use version_check::is_feature_flaggable; | ||
|
||
fn main() { | ||
println!("cargo::rustc-check-cfg=cfg(nightly)"); | ||
|
||
if is_feature_flaggable() == Some(true) { | ||
println!("cargo:rustc-cfg=nightly"); | ||
} | ||
} |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
#![cfg_attr(nightly, feature(doc_auto_cfg))] | ||
|
||
pub fn add(left: usize, right: usize) -> usize { | ||
left + right | ||
} | ||
|
||
#[cfg(test)] | ||
mod tests { | ||
use super::*; | ||
|
||
#[test] | ||
fn it_works() { | ||
let result = add(2, 2); | ||
assert_eq!(result, 4); | ||
} | ||
} |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
fn main() { | ||
println!("Hello, world!"); | ||
} |