Struct svgdom::Length
[−]
[src]
pub struct Length { pub num: f64, pub unit: LengthUnit, }
Representation of the <length>
type.
We use own struct and not one from svgparser, because of traits.
Fields
num: f64
unit: LengthUnit
Methods
impl Length
[src]
pub fn new(num: f64, unit: LengthUnit) -> Length
[src]
Constructs a new length.
pub fn new_number(num: f64) -> Length
[src]
Constructs a new length with LengthUnit::None
.
pub fn zero() -> Length
[src]
Constructs a new length with a zero value.
Shorthand for: Length::new(0.0, Unit::None)
.
Trait Implementations
impl From<Length> for AttributeValue
[src]
fn from(value: Length) -> AttributeValue
[src]
Performs the conversion.
impl Clone for Length
[src]
fn clone(&self) -> Length
[src]
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0[src]
Performs copy-assignment from source
. Read more
impl Copy for Length
[src]
impl PartialEq for Length
[src]
fn eq(&self, __arg_0: &Length) -> bool
[src]
This method tests for self
and other
values to be equal, and is used by ==
. Read more
fn ne(&self, __arg_0: &Length) -> bool
[src]
This method tests for !=
.
impl Debug for Length
[src]
fn fmt(&self, __arg_0: &mut Formatter) -> Result
[src]
Formats the value using the given formatter. Read more
impl FromStr for Length
[src]
type Err = ParseError
The associated error which can be returned from parsing.
fn from_str(s: &str) -> Result<Length, ParseError>
[src]
Parses a string s
to return a value of this type. Read more
impl ParseFromSpan for Length
[src]
type Err = ParseError
Error type.
fn from_span(span: StrSpan) -> Result<Length, ParseError>
[src]
Parses data from a StrSpan
.
impl WriteBuffer for Length
[src]
fn write_buf_opt(&self, opt: &WriteOptions, buf: &mut Vec<u8>)
[src]
Writes data to the Vec<u8>
buffer using specified WriteOptions
.
fn write_buf(&self, buf: &mut Vec<u8>)
[src]
Writes data to the Vec<u8>
buffer using default WriteOptions
.
impl Display for Length
[src]
fn fmt(&self, f: &mut Formatter) -> Result
[src]
Formats the value using the given formatter. Read more
impl ToStringWithOptions for Length
[src]
fn to_string_with_opt(&self, opt: &WriteOptions) -> String
[src]
Writes data to the String
using specified WriteOptions
.