Add a blog crate for demonstrating states

This commit is contained in:
Manuel Thalmann 2025-04-12 09:15:11 +02:00
parent cbbf0bb596
commit f924172cb4
Signed by: manuth
SSH key fingerprint: SHA256:HsMLC+7kJWALP6YCYCoopxNbUnghwSGLVcG76SECT5c
4 changed files with 35 additions and 0 deletions

7
blog/Cargo.lock generated Normal file
View file

@ -0,0 +1,7 @@
# This file is automatically @generated by Cargo.
# It is not intended for manual editing.
version = 4
[[package]]
name = "blog"
version = "0.1.0"

6
blog/Cargo.toml Normal file
View file

@ -0,0 +1,6 @@
[package]
name = "blog"
version = "0.1.0"
edition = "2024"
[dependencies]

19
blog/src/lib.rs Normal file
View file

@ -0,0 +1,19 @@
pub struct Post {
state: Option<Box<dyn State>>,
content: String,
}
impl Post {
pub fn new() -> Post {
Post {
state: Some(Box::new(Draft {})),
content: String::new(),
}
}
}
trait State {}
struct Draft {}
impl State for Draft {}

View file

@ -1,5 +1,8 @@
{
"folders": [
{
"path": "./blog"
},
{
"path": "./gui"
},