[][src]Struct geopattern::geo_pattern::GeoPattern

pub struct GeoPattern<'a> { /* fields omitted */ }

Methods

impl<'a> GeoPattern<'a>[src]

pub fn new(s: &str) -> GeoPattern[src]

This class uses the builder pattern for construction. A string is mandatory, hence is a parameter for construction. Rest of the options can be provided using static member functions. calling build finishes creating a new object.

pub fn color(self, color: Color) -> Self[src]

sets color

pub fn base_color(self, base_color: Color) -> Self[src]

sets base color

pub fn patterns(self, patterns: &'a [Patterns]) -> Self[src]

sets patterns to use

pub fn build(self) -> Result<Self, GeoPatternError>[src]

build internally builds the svg.

pub fn to_svg(&self) -> Result<&Document, GeoPatternError>[src]

returns a reference to svg::Document, if one has been built. The returned reference can be used with svg crate's functions, like svg::save

pub fn to_minified_svg(&self) -> Result<String, GeoPatternError>[src]

removes all the newlines from formatted svg::Document and returns it.

TODO: figure out if this is actually minified

pub fn to_data_uri(&self) -> Result<String, GeoPatternError>[src]

creates a data URI (data:image/svg+xml;utf8,...) from the minified svg.

pub fn to_base64(&self) -> Result<String, GeoPatternError>[src]

creates a base64 encoding of the minified svg.

pub fn to_base64_data_uri(&self) -> Result<String, GeoPatternError>[src]

creates a data URI (data:image/svg+xml;base64,...) of a base64 encoded svg.

Trait Implementations

impl<'a> Debug for GeoPattern<'a>[src]

Auto Trait Implementations

impl<'a> !Send for GeoPattern<'a>

impl<'a> !Sync for GeoPattern<'a>

Blanket Implementations

impl<T, U> Into for T where
    U: From<T>, 
[src]

impl<T> From for T[src]

impl<T, U> TryFrom for T where
    U: Into<T>, 
[src]

type Error = !

🔬 This is a nightly-only experimental API. (try_from)

The type returned in the event of a conversion error.

impl<T> Borrow for T where
    T: ?Sized
[src]

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> BorrowMut for T where
    T: ?Sized
[src]

impl<T, U> TryInto for T where
    U: TryFrom<T>, 
[src]

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

🔬 This is a nightly-only experimental API. (try_from)

The type returned in the event of a conversion error.