use crate::node;
use gantz_ca::CaHash;
use serde::{Deserialize, Serialize};
#[derive(
Copy, Clone, Debug, Eq, Hash, PartialEq, PartialOrd, Ord, Deserialize, Serialize, CaHash,
)]
pub struct Edge {
pub output: node::Output,
pub input: node::Input,
}
impl Edge {
pub fn new(output: node::Output, input: node::Input) -> Self {
Edge { output, input }
}
}
impl<A, B> From<(A, B)> for Edge
where
A: Into<node::Output>,
B: Into<node::Input>,
{
fn from((a, b): (A, B)) -> Self {
let output = a.into();
let input = b.into();
Edge { output, input }
}
}