Replies: 167 comments 99 replies
-
|
谢谢大佬,这本书真的写的很好😉 |
Beta Was this translation helpful? Give feedback.
-
感谢鼓励 :) |
Beta Was this translation helpful? Give feedback.
-
|
感谢大佬 收获好大 弄明白了很多以前糊里糊涂的概念 |
Beta Was this translation helpful? Give feedback.
-
|
感谢大佬,写的通俗易懂,比什么心智模型balabala一堆术语好太多了。 |
Beta Was this translation helpful? Give feedback.
-
|
Beta Was this translation helpful? Give feedback.
-
|
我在想结构体上的生命周期为什么不能省略,在例子中结构体只有一个引用的时候,这个引用的有效性其实编译器是可以推断出来的啊 |
Beta Was this translation helpful? Give feedback.
-
|
大佬,能不能写些实际的例子?比如 teacher {vector<student&>} 另外所有的方法和结构体的生命周期均要求teacher大于student |
Beta Was this translation helpful? Give feedback.
-
|
“借用检查”上面那段,写成“垂悬”了 |
Beta Was this translation helpful? Give feedback.
-
|
辛苦了大佬 没有你的文章我估计还要在 rust学习路上撞得头破血流 |
Beta Was this translation helpful? Give feedback.
-
|
写得挺好。谢谢分享。 |
Beta Was this translation helpful? Give feedback.
-
|
谢谢大佬,这本书真的写的很好😉 |
Beta Was this translation helpful? Give feedback.
-
|
首先感谢下作者,一直看这本书学习,第一次发评论。
以下代码可运行。 fn main() { 以下代码也可运行: fn main() { |
Beta Was this translation helpful? Give feedback.
-
|
哈哈哈哈,rust 编译器还真是个磨人的小妖精~ |
Beta Was this translation helpful? Give feedback.
-
|
感谢作者,这个例子举的很好,帮助我更好的理解了生命周期。 |
Beta Was this translation helpful? Give feedback.
-
|
谢谢大佬,写的真好 ❤️ |
Beta Was this translation helpful? Give feedback.
-
|
生命周期只是为了取悦编译器。这种事情有更好的实现方案吗?(比如引用计数?) |
Beta Was this translation helpful? Give feedback.
-
|
struct ImportantExcerpt<'a> { |
Beta Was this translation helpful? Give feedback.
-
|
感觉看完后对输入生命周期和输出生命周期的区别不是理解很深。感觉应该指出一下若输出变量存活时间超过输出生命周期,编译器即认为会发生悬垂引用 导致报错 |
Beta Was this translation helpful? Give feedback.
-
|
太好了,小白最好的老师,希望能继续更新,进度条快一半了,真的就像看小说一样爽 |
Beta Was this translation helpful? Give feedback.
-
|
碉堡了 |
Beta Was this translation helpful? Give feedback.
-
请问这里的特征对象是指什么意思?他们为什么会有生命周期的概念? |
Beta Was this translation helpful? Give feedback.
-
|
生命周期,还有一点没看懂 |
Beta Was this translation helpful? Give feedback.
-
|
嘿,爷内存硬盘不值钱,每个变量都给我静态周期(doge)(好像和内存泄露就没区别了) |
Beta Was this translation helpful? Give feedback.
-
真的很好 |
Beta Was this translation helpful? Give feedback.
-
impl<'a: 'b, 'b> ImportantExcerpt<'a> {
fn announce_and_return_part(&'a self, announcement: &'b str) -> &'b str {
self.part
}
}
impl<'a> ImportantExcerpt<'a> {
fn announce_and_return_part<'b>(&'a self, announcement: &'b str) -> &'b str
where
'a: 'b,
{
println!("Attention please: {}", announcement);
self.part
}
}两者有细微区别?'b的在前者中是整个impl维度可用的? |
Beta Was this translation helpful? Give feedback.
-
|
生命周期都看明白了特质还没看懂(无语 |
Beta Was this translation helpful? Give feedback.
-
|
补充一个我的疑惑,以及我找到的答案 为什么需要标注生命周期? fn longest<'a>(x: &'a str, y: &'a str) -> &'a str {...}
fn main() {
let s1 = String::from("short");
let result;
{
let s2 = String::from("loooong");
result = longest(&s1, &s2); // 这里编译器检查生命周期
}
// println!("{}", result); // 错误:result 可能引用已 drop 的 s2
} |
Beta Was this translation helpful? Give feedback.
-
|
写的不错,我这种猪鼻都能看懂 |
Beta Was this translation helpful? Give feedback.
-
|
作者厉害,感谢 |
Beta Was this translation helpful? Give feedback.
-
|
在手机端时代码里那个copy 按钮总是挡住代码内容了 |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
https://course.rs/advance/lifetime/basic.html
Beta Was this translation helpful? Give feedback.
All reactions