reorganized the directories

This commit is contained in:
Unisko PENG
2023-04-11 17:17:17 +08:00
parent a957d08fd7
commit 2aaae6f4d2
180 changed files with 3325 additions and 1 deletions

View File

@@ -0,0 +1,8 @@
[package]
name = "lifetimes_demo"
version = "0.1.0"
edition = "2021"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies]

View File

@@ -0,0 +1,23 @@
use std::fmt::Display;
fn longest_with_an_announcement<'a, T>(
x: &'a str,
y: &'a str,
ann: T,
) -> &'a str
where
T: Display,
{
println! ("通知!{}", ann);
if x.len() > y.len() {
x
} else {
y
}
}
fn main() {
let result = longest_with_an_announcement("abc", "测试", "计算结果已出来。");
println! ("{}", result);
}