mirror of
https://github.com/KaiserY/trpl-zh-cn
synced 2025-02-24 21:32:15 +08:00
26 lines
380 B
Rust
Executable File
26 lines
380 B
Rust
Executable File
pub struct Post {
|
|
content: String,
|
|
}
|
|
|
|
pub struct DraftPost {
|
|
content: String,
|
|
}
|
|
|
|
impl Post {
|
|
pub fn new() -> DraftPost {
|
|
DraftPost {
|
|
content: String::new(),
|
|
}
|
|
}
|
|
|
|
pub fn content(&self) -> &str {
|
|
&self.content
|
|
}
|
|
}
|
|
|
|
impl DraftPost {
|
|
pub fn add_text(&mut self, text: &str) {
|
|
self.content.push_str(text);
|
|
}
|
|
}
|