diff options
Diffstat (limited to 'common')
-rw-r--r-- | common/src/impl.rs | 8 | ||||
-rw-r--r-- | common/src/lib.rs | 4 |
2 files changed, 9 insertions, 3 deletions
diff --git a/common/src/impl.rs b/common/src/impl.rs index 55364ab..d7759af 100644 --- a/common/src/impl.rs +++ b/common/src/impl.rs @@ -3,7 +3,7 @@ which is licensed under the GNU Affero General Public License (version 3); see /COPYING. Copyright (C) 2023 metamuffin <metamuffin.org> */ -use crate::{SourceTrack, SourceTrackKind}; +use crate::{NodeKind, SourceTrack, SourceTrackKind}; impl SourceTrackKind { pub fn letter(&self) -> char { @@ -34,3 +34,9 @@ impl std::fmt::Display for SourceTrack { )) } } + +impl Default for NodeKind { + fn default() -> Self { + Self::Collection + } +} diff --git a/common/src/lib.rs b/common/src/lib.rs index 60cb37f..a96df9e 100644 --- a/common/src/lib.rs +++ b/common/src/lib.rs @@ -17,7 +17,7 @@ pub struct Node { } #[rustfmt::skip] -#[derive(Debug, Clone, Deserialize, Serialize)] +#[derive(Debug, Clone, Deserialize, Serialize, Default)] pub struct NodePrivate { #[serde(default)] pub id: Option<String>, #[serde(default)] pub import: Option<RemoteImportOptions>, @@ -27,7 +27,7 @@ pub struct NodePrivate { } #[rustfmt::skip] -#[derive(Debug, Clone, Deserialize, Serialize)] +#[derive(Debug, Clone, Deserialize, Serialize, Default)] pub struct NodePublic { pub kind: NodeKind, pub title: String, |