Derive Document for simple enums
This commit is contained in:
parent
458025b8bf
commit
6f85995379
3 changed files with 36 additions and 23 deletions
|
|
@ -7,7 +7,7 @@ use cove_input::KeyBinding;
|
|||
pub use cove_macro::Document;
|
||||
use serde::Serialize;
|
||||
|
||||
pub(crate) fn toml_value_as_markdown<T: Serialize>(value: &T) -> String {
|
||||
pub fn toml_value_as_markdown<T: Serialize>(value: &T) -> String {
|
||||
let mut result = String::new();
|
||||
value
|
||||
.serialize(toml::ser::ValueSerializer::new(&mut result))
|
||||
|
|
|
|||
|
|
@ -1,10 +1,10 @@
|
|||
use std::collections::HashMap;
|
||||
|
||||
use serde::Deserialize;
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
use crate::doc::{Doc, Document};
|
||||
use crate::doc::Document;
|
||||
|
||||
#[derive(Debug, Clone, Copy, Default, Deserialize)]
|
||||
#[derive(Debug, Clone, Copy, Default, Serialize, Deserialize, Document)]
|
||||
#[serde(rename_all = "snake_case")]
|
||||
pub enum RoomsSortOrder {
|
||||
#[default]
|
||||
|
|
@ -12,18 +12,6 @@ pub enum RoomsSortOrder {
|
|||
Importance,
|
||||
}
|
||||
|
||||
impl Document for RoomsSortOrder {
|
||||
fn doc() -> Doc {
|
||||
let mut doc = String::doc();
|
||||
doc.value_info.values = Some(vec![
|
||||
// TODO Generate by serializing
|
||||
"`alphabet`".to_string(),
|
||||
"`importance`".to_string(),
|
||||
]);
|
||||
doc
|
||||
}
|
||||
}
|
||||
|
||||
// TODO Mark favourite rooms via printable ascii characters
|
||||
#[derive(Debug, Clone, Default, Deserialize, Document)]
|
||||
pub struct EuphRoom {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue