summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Howell <michael@notriddle.com>2022-07-06 14:53:13 -0700
committerMichael Howell <michael@notriddle.com>2022-07-06 14:53:13 -0700
commitd2c2e539985582e7a06011b4495aa47ebf38747c (patch)
treef3c873317396ac1ee7e8cee3e585a06d077a5b44
parent0e6ba07bb553ad178b4952659d2f2a39714fd974 (diff)
downloadlibrsvg-d2c2e539985582e7a06011b4495aa47ebf38747c.tar.gz
micro-optimization: use Box slice instead of Vec for Attributes
Part of #706 Part-of: <https://gitlab.gnome.org/GNOME/librsvg/-/merge_requests/712>
-rw-r--r--src/xml/attributes.rs6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/xml/attributes.rs b/src/xml/attributes.rs
index 8afa02d8..c2c5ac62 100644
--- a/src/xml/attributes.rs
+++ b/src/xml/attributes.rs
@@ -20,7 +20,7 @@ pub type AttributeValue = DefaultAtom;
///
/// [`new_from_xml2_attributes`]: #method.new_from_xml2_attributes
#[derive(Clone)]
-pub struct Attributes(Vec<(QualName, AttributeValue)>);
+pub struct Attributes(Box<[(QualName, AttributeValue)]>);
/// Iterator from `Attributes.iter`.
pub struct AttributesIter<'a>(slice::Iter<'a, (QualName, AttributeValue)>);
@@ -28,7 +28,7 @@ pub struct AttributesIter<'a>(slice::Iter<'a, (QualName, AttributeValue)>);
impl Attributes {
#[cfg(test)]
pub fn new() -> Attributes {
- Attributes(Vec::new())
+ Attributes([].into())
}
/// Creates an iterable `Attributes` from the C array of borrowed C strings.
@@ -92,7 +92,7 @@ impl Attributes {
}
}
- Attributes(array)
+ Attributes(array.into())
}
/// Returns the number of attributes.