Skip to content

Commit

Permalink
🎉 Initialize project
Browse files Browse the repository at this point in the history
  • Loading branch information
czy-29 committed Nov 19, 2024
1 parent 4b688fe commit 5020d4d
Show file tree
Hide file tree
Showing 5 changed files with 73 additions and 0 deletions.
16 changes: 16 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

29 changes: 29 additions & 0 deletions Cargo.toml
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"
9 changes: 9 additions & 0 deletions build.rs
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");
}
}
16 changes: 16 additions & 0 deletions src/lib.rs
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);
}
}
3 changes: 3 additions & 0 deletions src/main.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
fn main() {
println!("Hello, world!");
}

0 comments on commit 5020d4d

Please sign in to comment.