castep_cell_io/param/general/
comment.rs1use castep_cell_fmt::{Cell, CellValue, ToCell, ToCellValue, CResult};
2use castep_cell_fmt::parse::FromKeyValue;
3use castep_cell_fmt::query::value_as_str;
4
5#[derive(Debug, Clone, PartialEq, Eq)]
14pub struct Comment(pub String);
15
16impl FromKeyValue for Comment {
17 const KEY_NAME: &'static str = "COMMENT";
18
19 fn from_cell_value_kv(value: &CellValue<'_>) -> CResult<Self> {
20 Ok(Self(value_as_str(value)?.to_string()))
21 }
22}
23
24impl ToCell for Comment {
25 fn to_cell(&self) -> Cell<'_> {
26 Cell::KeyValue("COMMENT", CellValue::String(self.0.clone()))
27 }
28}
29
30impl ToCellValue for Comment {
31 fn to_cell_value(&self) -> CellValue<'_> {
32 CellValue::String(self.0.clone())
33 }
34}
35
36