pub struct PathBuilder { /* private fields */ }Expand description
Collects path verbs fluently and reports the first failure from Self::build.
Once a step fails, later steps are ignored so the reported error is the first one.
use motion_core::{Path2D, Point};
let path = Path2D::builder()
.move_to(Point::ORIGIN)
.line_to(Point::new(4.0, 0.0))
.close()
.build()?;
assert_eq!(path.verbs().len(), 3);
assert!(Path2D::builder().line_to(Point::ORIGIN).build().is_err());Implementations§
Source§impl PathBuilder
impl PathBuilder
Sourcepub fn quadratic_to(self, control: Point, end: Point) -> Self
pub fn quadratic_to(self, control: Point, end: Point) -> Self
Adds a quadratic Bezier; requires a preceding move.
Sourcepub fn cubic_to(self, first: Point, second: Point, end: Point) -> Self
pub fn cubic_to(self, first: Point, second: Point, end: Point) -> Self
Adds a cubic Bezier; requires a preceding move.
Sourcepub fn arc_to(
self,
center: Point,
radii: Vector2,
start_angle: f64,
sweep_angle: f64,
) -> Self
pub fn arc_to( self, center: Point, radii: Vector2, start_angle: f64, sweep_angle: f64, ) -> Self
Appends a clockwise elliptical arc; see Path2D::try_arc_to.
Sourcepub fn build(self) -> Result<Path2D, ValidationError>
pub fn build(self) -> Result<Path2D, ValidationError>
Returns the finished path or the first error recorded while building.
Trait Implementations§
Source§impl Clone for PathBuilder
impl Clone for PathBuilder
Source§impl Debug for PathBuilder
impl Debug for PathBuilder
Auto Trait Implementations§
impl Forget for PathBuilder
impl Freeze for PathBuilder
impl Move for PathBuilder
impl RefUnwindSafe for PathBuilder
impl Send for PathBuilder
impl Sync for PathBuilder
impl Unpin for PathBuilder
impl UnsafeUnpin for PathBuilder
impl UnwindSafe for PathBuilder
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
Mutably borrows from an owned value. Read more