add defaults for the several structs

This commit is contained in:
zhguchev
2022-01-11 14:56:26 +01:00
committed by Sébastien Crozet
parent 1608a1323e
commit 536122e080
12 changed files with 46 additions and 10 deletions

View File

@@ -52,10 +52,16 @@ pub struct Index {
generation: u32,
}
impl IndexedData for Index {
impl Default for Index {
fn default() -> Self {
Self::from_raw_parts(crate::INVALID_U32, crate::INVALID_U32)
}
}
impl IndexedData for Index {
fn default() -> Self {
Default::default()
}
fn index(&self) -> usize {
self.into_raw_parts().0 as usize

View File

@@ -125,7 +125,7 @@ impl<E> Edge<E> {
}
}
#[derive(Clone, Debug)]
#[derive(Clone, Debug,Default)]
#[cfg_attr(feature = "serde-serialize", derive(Serialize, Deserialize))]
pub struct Graph<N, E> {
pub(crate) nodes: Vec<Node<N>>,