puppy/lib/store/src/mixin.rs

36 lines
761 B
Rust
Raw Normal View History

2024-04-21 09:49:02 +02:00
//! Modules of information.
use bincode::{Decode, Encode};
use crate::Space;
/// A simple piece of data associated with a vertex.
pub trait Mixin: Encode + Decode {
const SPACE: Space;
}
/// Information needed to render a social media profile.
#[derive(Encode, Decode)]
pub struct Profile {
pub post_count: usize,
pub account_name: String,
pub display_name: Option<String>,
pub about_string: Option<String>,
pub about_fields: Vec<(String, String)>,
}
impl Mixin for Profile {
const SPACE: Space = Space("profile");
}
/// Contents of a post.
#[derive(Encode, Decode)]
pub struct Content {
pub content: Option<String>,
pub summary: Option<String>,
}
impl Mixin for Content {
const SPACE: Space = Space("content");
}