use crate::{
Bluegum,
BluegumWithState,
};
impl Bluegum for url::Url {
fn node(&self, b: &mut crate::Builder) {
b.name("Url")
.field("scheme", self.scheme())
.option_field(
"username",
if self.username().is_empty() {
None
} else {
Some(self.username())
},
)
.option_field("password", self.password())
.option_field("host", self.host_str())
.option_field("port", self.port())
.field("path", self.path())
.option_field("query", self.query())
.option_field("fragment", self.fragment());
}
}
impl<State> BluegumWithState<State> for url::Url {
fn node_with_state(&self, b: &mut crate::Builder, _state: &State) {
b.name("Url")
.field("scheme", self.scheme())
.option_field(
"username",
if self.username().is_empty() {
None
} else {
Some(self.username())
},
)
.option_field("password", self.password())
.option_field("host", self.host_str())
.option_field("port", self.port())
.field("path", self.path())
.option_field("query", self.query())
.option_field("fragment", self.fragment());
}
}