diff options
author | Michael Howell <michael@notriddle.com> | 2022-07-06 14:53:13 -0700 |
---|---|---|
committer | Michael Howell <michael@notriddle.com> | 2022-07-06 14:53:13 -0700 |
commit | d2c2e539985582e7a06011b4495aa47ebf38747c (patch) | |
tree | f3c873317396ac1ee7e8cee3e585a06d077a5b44 | |
parent | 0e6ba07bb553ad178b4952659d2f2a39714fd974 (diff) | |
download | librsvg-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.rs | 6 |
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. |