Skip to content

Commit

Permalink
Serialize Weights + PortOffset (#36)
Browse files Browse the repository at this point in the history
  • Loading branch information
lmondada authored May 9, 2023
1 parent 31040fc commit 071fcbf
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -259,6 +259,7 @@ pub struct IndexError {

/// Port offset in a node
#[derive(Clone, Copy, PartialEq, PartialOrd, Eq, Ord, Hash)]
#[cfg_attr(feature = "serde", derive(Deserialize, Serialize))]
pub enum PortOffset {
/// Input to a node
///
Expand Down
4 changes: 4 additions & 0 deletions src/weights.rs
Original file line number Diff line number Diff line change
Expand Up @@ -40,11 +40,15 @@
use std::ops::{Index, IndexMut};

#[cfg(feature = "serde")]
use serde::{Deserialize, Serialize};

use crate::{NodeIndex, PortIndex, SecondaryMap};

/// Graph component that encodes node and port weights.
/// Based on two [`SecondaryMap`] containers.
#[derive(Debug, Clone)]
#[cfg_attr(feature = "serde", derive(Deserialize, Serialize))]
pub struct Weights<N, P> {
/// Node weights.
pub nodes: SecondaryMap<NodeIndex, N>,
Expand Down

0 comments on commit 071fcbf

Please sign in to comment.