plantuml_server_client_rs/
url.rs1use crate::Format;
2
3pub const URL_PREFIX: &str = "http://www.plantuml.com/plantuml/";
5
6pub struct UrlBuilder {
8 prefix: String,
9 format: Format,
10}
11
12impl UrlBuilder {
13 pub fn new() -> Self {
15 Self {
16 prefix: URL_PREFIX.into(),
17 format: Format::Svg,
18 }
19 }
20
21 pub fn build(self, data: String) -> String {
25 let format: &str = (&self.format).into();
26 format!("{}{format}/{data}", self.prefix)
27 }
28
29 pub fn prefix(self, prefix: String) -> Self {
31 Self { prefix, ..self }
32 }
33
34 pub fn format(self, format: Format) -> Self {
36 Self { format, ..self }
37 }
38}
39
40impl Default for UrlBuilder {
41 fn default() -> Self {
42 Self::new()
43 }
44}