ViewBox

Struct ViewBox 

Source
pub struct ViewBox {
    pub min_x: SvgInteger,
    pub min_y: SvgInteger,
    pub width: SvgInteger,
    pub height: SvgInteger,
}
Expand description

The viewBox attribute defines the position and dimension, in user space, of an SVG viewport.

The value of the viewBox attribute is a list of four numbers: min-x, min-y, width and height. The numbers, which are separated by whitespace and/or a comma, specify a rectangle in user space which is mapped to the bounds of the viewport established for the associated SVG element (not the browser viewport).

A viewBox can be constructed out of a tuple:

let view_box: svgplot::ViewBox = (1, 2, 3, 4).into();
assert_eq!(view_box.min_x, 1);
assert_eq!(view_box.min_y, 2);
assert_eq!(view_box.width, 3);
assert_eq!(view_box.height, 4);

Fields§

§min_x: SvgInteger§min_y: SvgInteger§width: SvgInteger§height: SvgInteger

Trait Implementations§

Source§

impl From<(i64, i64, i64, i64)> for ViewBox

Source§

fn from(value: (SvgInteger, SvgInteger, SvgInteger, SvgInteger)) -> Self

Converts to this type from the input type.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.