Struct svgtypes::PathBuilder

source ·
pub struct PathBuilder { /* private fields */ }
Expand description

A builder for Path.

Examples

Ellipse to path:

use svgtypes::PathBuilder;

let (cx, cy, rx, ry) = (10.0, 20.0, 5.0, 8.0);

let path = PathBuilder::with_capacity(6)
    .move_to(cx + rx, cy)
    .arc_to(rx, ry, 0.0, false, true, cx,      cy + ry)
    .arc_to(rx, ry, 0.0, false, true, cx - rx, cy)
    .arc_to(rx, ry, 0.0, false, true, cx,      cy - ry)
    .arc_to(rx, ry, 0.0, false, true, cx + rx, cy)
    .close_path()
    .finalize();

assert_eq!(path.to_string(), "M 15 20 A 5 8 0 0 1 10 28 A 5 8 0 0 1 5 20 \
                              A 5 8 0 0 1 10 12 A 5 8 0 0 1 15 20 Z");

Implementations

Constructs a new builder.

Constructs a new builder with a specified capacity.

Appends a new absolute MoveTo segment.

Appends a new relative MoveTo segment.

Appends a new absolute ClosePath segment.

Appends a new relative ClosePath segment.

Appends a new absolute LineTo segment.

Appends a new relative LineTo segment.

Appends a new absolute HorizontalLineTo segment.

Appends a new relative HorizontalLineTo segment.

Appends a new absolute VerticalLineTo segment.

Appends a new relative VerticalLineTo segment.

Appends a new absolute CurveTo segment.

Appends a new relative CurveTo segment.

Appends a new absolute SmoothCurveTo segment.

Appends a new relative SmoothCurveTo segment.

Appends a new absolute QuadTo segment.

Appends a new relative QuadTo segment.

Appends a new absolute SmoothQuadTo segment.

Appends a new relative SmoothQuadTo segment.

Appends a new absolute ArcTo segment.

Appends a new relative ArcTo segment.

Finalizes the build.

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

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

The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.