1use std::collections::hash_map::DefaultHasher;
2use std::fmt;
3use std::hash::Hash;
4
5use crate::node::Node;
6
7#[derive(Clone, Debug)]
9pub struct Blob {
10 content: String,
11}
12
13impl Blob {
14 #[inline]
16 pub fn new<T>(content: T) -> Self
17 where
18 T: Into<String>,
19 {
20 Blob {
21 content: content.into(),
22 }
23 }
24}
25
26impl fmt::Display for Blob {
27 #[inline]
28 fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
29 self.content.fmt(formatter)
30 }
31}
32
33impl Node for Blob {
34 #[inline]
35 fn get_name(&self) -> &str {
36 "blob"
37 }
38}
39
40impl super::NodeDefaultHash for Blob {
41 #[inline]
42 fn default_hash(&self, state: &mut DefaultHasher) {
43 self.content.hash(state);
44 }
45}