Struct rsvg::IntrinsicDimensions
source · pub struct IntrinsicDimensions {
pub width: Length,
pub height: Length,
pub vbox: Option<Rectangle>,
}
Expand description
Contains the computed values of the <svg>
element’s width
, height
, and viewBox
.
An SVG document has a toplevel <svg>
element, with optional attributes width
,
height
, and viewBox
. This structure contains the values for those attributes; you
can obtain the struct from CairoRenderer::intrinsic_dimensions
.
Since librsvg 2.54.0, there is support for geometry
properties from SVG2. This means that
width
and height
are no longer attributes; they are instead CSS properties that
default to auto
. The computed value for auto
is 100%
, so for a <svg>
that
does not have these attributes/properties, the width
/height
fields will be
returned as a Length
of 100%.
As an example, the following SVG element has a width
of 100 pixels
and a height
of 400 pixels, but no viewBox
.
<svg xmlns="http://www.w3.org/2000/svg" width="100" height="400">
In this case, the length fields will be set to the corresponding
values with LengthUnit::Px
units, and the vbox
field will be
set to to None
.
Fields§
§width: Length
Computed value of the width
property of the <svg>
.
height: Length
Computed value of the height
property of the <svg>
.
vbox: Option<Rectangle>
viewBox
attribute of the <svg>
, if present.
Trait Implementations§
source§impl Clone for IntrinsicDimensions
impl Clone for IntrinsicDimensions
source§fn clone(&self) -> IntrinsicDimensions
fn clone(&self) -> IntrinsicDimensions
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moresource§impl Debug for IntrinsicDimensions
impl Debug for IntrinsicDimensions
source§impl PartialEq for IntrinsicDimensions
impl PartialEq for IntrinsicDimensions
source§fn eq(&self, other: &IntrinsicDimensions) -> bool
fn eq(&self, other: &IntrinsicDimensions) -> bool
self
and other
values to be equal, and is used
by ==
.impl Copy for IntrinsicDimensions
impl StructuralPartialEq for IntrinsicDimensions
Auto Trait Implementations§
impl RefUnwindSafe for IntrinsicDimensions
impl Send for IntrinsicDimensions
impl Sync for IntrinsicDimensions
impl Unpin for IntrinsicDimensions
impl UnwindSafe for IntrinsicDimensions
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
source§impl<T> IntoEither for T
impl<T> IntoEither for T
source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moresource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more§impl<T> Pointable for T
impl<T> Pointable for T
§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
self
from the equivalent element of its
superset. Read more§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
self
is actually part of its subset T
(and can be converted to it).§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
self.to_subset
but without any property checks. Always succeeds.§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
self
to the equivalent element of its superset.