1use std::fmt::Display;
2
3use serde::{Deserialize, Serialize};
4use void::Void;
5
6#[derive(Deserialize, Serialize, Debug, PartialEq, Hash, Eq, Clone)]
7pub struct BNode {
8 value: String,
9}
10
11impl BNode {
12 pub fn new(s: &str) -> BNode {
13 BNode {
14 value: s.to_string(),
15 }
16 }
17}
18
19impl TryFrom<&str> for BNode {
20 type Error = Void;
21 fn try_from(s: &str) -> Result<Self, Self::Error> {
22 Ok(BNode {
23 value: s.to_string(),
24 })
25 }
26}
27
28impl Display for BNode {
29 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
30 write!(f, "_:{}", self.value)
31 }
32}