Function rsvg::href::is_href

source ·
pub fn is_href(name: &ExpandedName<'_>) -> bool
Expand description

Returns whether the attribute is either of xlink:href or href.

§Example

Use with an if pattern inside a match:


let qual_name = QualName::new(
    Some(Prefix::from("xlink")),
    Namespace::from("http://www.w3.org/1999/xlink"),
    LocalName::from("href"),
);

let value = "some_url";
let mut my_field: Option<String> = None;

match qual_name.expanded() {
    ref name if is_href(name) => set_href(name, &mut my_field, Some(value.to_string())),
    _ => unreachable!(),
}