bolt_proto/message/
route_with_metadata.rs1use std::collections::HashMap;
2
3use bolt_proto_derive::*;
4
5use crate::{impl_try_from_message, message::SIGNATURE_ROUTE, Value};
6
7#[bolt_structure(SIGNATURE_ROUTE)]
8#[derive(Debug, Clone, Eq, PartialEq)]
9pub struct RouteWithMetadata {
10 pub(crate) context: HashMap<String, Value>,
11 pub(crate) bookmarks: Vec<String>,
12 pub(crate) metadata: HashMap<String, Value>,
13}
14
15impl RouteWithMetadata {
16 pub fn new(
17 context: HashMap<String, Value>,
18 bookmarks: Vec<String>,
19 metadata: HashMap<String, Value>,
20 ) -> Self {
21 Self {
22 context,
23 bookmarks,
24 metadata,
25 }
26 }
27
28 pub fn context(&self) -> &HashMap<String, Value> {
29 &self.context
30 }
31
32 pub fn bookmarks(&self) -> &[String] {
33 &self.bookmarks
34 }
35
36 pub fn metadata(&self) -> &HashMap<String, Value> {
37 &self.metadata
38 }
39}
40
41impl_try_from_message!(RouteWithMetadata, RouteWithMetadata);