rill_protocol/flow/
location.rs1use crate::io::provider::{EntryId, Path};
2
3pub struct Location {
4 element: &'static str,
5}
6
7impl Location {
8 pub const fn new(element: &'static str) -> Self {
9 Self { element }
10 }
11
12 pub fn of(&self, mut path: Path) -> Path {
13 let entry_id: EntryId = EntryId::from(self.element);
14 path.push(entry_id);
15 path
16 }
17
18 pub fn of_server(&self) -> Path {
19 self.of(server())
20 }
21
22 pub fn of_client(&self) -> Path {
23 self.of(client())
24 }
25
26 pub fn root(&self) -> Path {
27 Path::single(self.element)
28 }
29}
30
31pub fn server() -> Path {
32 Path::single("@server")
33}
34
35pub fn client() -> Path {
36 Path::single("@self")
37}