Struct lyon_path::builder::NoAttributes

source ·
pub struct NoAttributes<B: PathBuilder> { /* private fields */ }
Expand description

A convenience wrapper for PathBuilder without custom attributes.

See the PathBuilder trait.

This simply forwards to an underlying PathBuilder implementation, using no attributes.

Implementations§

source§

impl<B: PathBuilder> NoAttributes<B>

source

pub fn wrap(inner: B) -> Self

source

pub fn new() -> Self
where B: Default,

source

pub fn with_capacity(endpoints: usize, ctrl_points: usize) -> Self
where B: Default,

source

pub fn begin(&mut self, at: Point) -> EndpointId

Starts a new sub-path at a given position.

There must be no sub-path in progress when this method is called. at becomes the current position of the sub-path.

source

pub fn end(&mut self, close: bool)

Ends the current sub path.

A sub-path must be in progress when this method is called. After this method is called, there is no sub-path in progress until begin is called again.

source

pub fn close(&mut self)

Closes the current sub path.

Shorthand for builder.end(true).

source

pub fn line_to(&mut self, to: Point) -> EndpointId

Adds a line segment to the current sub-path.

A sub-path must be in progress when this method is called.

source

pub fn quadratic_bezier_to(&mut self, ctrl: Point, to: Point) -> EndpointId

Adds a quadratic bézier curve to the current sub-path.

A sub-path must be in progress when this method is called.

source

pub fn cubic_bezier_to( &mut self, ctrl1: Point, ctrl2: Point, to: Point, ) -> EndpointId

Adds a cubic bézier curve to the current sub-path.

A sub-path must be in progress when this method is called.

source

pub fn reserve(&mut self, endpoints: usize, ctrl_points: usize)

Hints at the builder that a certain number of endpoints and control points will be added.

The Builder implementation may use this information to pre-allocate memory as an optimization.

source

pub fn path_event(&mut self, event: PathEvent)

Applies the provided path event.

By default this calls one of begin, end, line, quadratic_bezier_segment, or cubic_bezier_segment according to the path event.

The requirements for each method apply to the corresponding event.

source

pub fn add_polygon(&mut self, polygon: Polygon<'_, Point>)

Adds a sub-path from a polygon.

There must be no sub-path in progress when this method is called. No sub-path is in progress after the method is called.

source

pub fn add_point(&mut self, at: Point) -> EndpointId

Adds a sub-path containing a single point.

There must be no sub-path in progress when this method is called. No sub-path is in progress after the method is called.

source

pub fn add_line_segment( &mut self, line: &LineSegment<f32>, ) -> (EndpointId, EndpointId)

Adds a sub-path containing a single line segment.

There must be no sub-path in progress when this method is called. No sub-path is in progress after the method is called.

source

pub fn add_ellipse( &mut self, center: Point, radii: Vector, x_rotation: Angle, winding: Winding, )

Adds a sub-path containing an ellipse.

There must be no sub-path in progress when this method is called. No sub-path is in progress after the method is called.

source

pub fn add_circle(&mut self, center: Point, radius: f32, winding: Winding)
where B: Sized,

Adds a sub-path containing a circle.

There must be no sub-path in progress when this method is called. No sub-path is in progress after the method is called.

source

pub fn add_rectangle(&mut self, rect: &Box2D, winding: Winding)

Adds a sub-path containing a rectangle.

There must be no sub-path in progress when this method is called. No sub-path is in progress after the method is called.

source

pub fn add_rounded_rectangle( &mut self, rect: &Box2D, radii: &BorderRadii, winding: Winding, )
where B: Sized,

Adds a sub-path containing a rectangle.

There must be no sub-path in progress when this method is called. No sub-path is in progress after the method is called.

source

pub fn flattened(self, tolerance: f32) -> NoAttributes<Flattened<B>>
where B: Sized,

Returns a builder that approximates all curves with sequences of line segments.

source

pub fn transformed<Transform>( self, transform: Transform, ) -> NoAttributes<Transformed<B, Transform>>
where B: Sized, Transform: Transformation<f32>,

Returns a builder that applies the given transformation to all positions.

source

pub fn with_svg(self) -> WithSvg<B>
where B: Sized,

Returns a builder that support SVG commands.

This must be called before starting to add any sub-path.

source

pub fn build<P>(self) -> P
where B: Build<PathType = P>,

Builds a path object, consuming the builder.

source

pub fn inner(&self) -> &B

source

pub fn inner_mut(&mut self) -> &mut B

source

pub fn into_inner(self) -> B

source§

impl NoAttributes<BuilderImpl>

source

pub fn extend_from_paths(&mut self, paths: &[PathSlice<'_>])

Trait Implementations§

source§

impl<B: PathBuilder + Build> Build for NoAttributes<B>

source§

type PathType = <B as Build>::PathType

The type of object that is created by this builder.
source§

fn build(self) -> B::PathType

Builds a path object, consuming the builder.
source§

impl<B: Clone + PathBuilder> Clone for NoAttributes<B>

source§

fn clone(&self) -> NoAttributes<B>

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl<B: Debug + PathBuilder> Debug for NoAttributes<B>

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl<B: PathBuilder + Default> Default for NoAttributes<B>

source§

fn default() -> Self

Returns the “default value” for a type. Read more
source§

impl<B: Hash + PathBuilder> Hash for NoAttributes<B>

source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
source§

impl<B: PartialEq + PathBuilder> PartialEq for NoAttributes<B>

source§

fn eq(&self, other: &NoAttributes<B>) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl<B: PathBuilder> PathBuilder for NoAttributes<B>

source§

fn num_attributes(&self) -> usize

source§

fn begin(&mut self, at: Point, _attributes: Attributes<'_>) -> EndpointId

Starts a new sub-path at a given position. Read more
source§

fn end(&mut self, close: bool)

Ends the current sub path. Read more
source§

fn line_to(&mut self, to: Point, _attributes: Attributes<'_>) -> EndpointId

Adds a line segment to the current sub-path. Read more
source§

fn quadratic_bezier_to( &mut self, ctrl: Point, to: Point, _attributes: Attributes<'_>, ) -> EndpointId

Adds a quadratic bézier curve to the current sub-path. Read more
source§

fn cubic_bezier_to( &mut self, ctrl1: Point, ctrl2: Point, to: Point, _attributes: Attributes<'_>, ) -> EndpointId

Adds a cubic bézier curve to the current sub-path. Read more
source§

fn reserve(&mut self, endpoints: usize, ctrl_points: usize)

Hints at the builder that a certain number of endpoints and control points will be added. Read more
source§

fn close(&mut self)

Closes the current sub path. Read more
source§

fn path_event(&mut self, event: PathEvent, attributes: Attributes<'_>)

Applies the provided path event. Read more
source§

fn event(&mut self, event: Event<(Point, Attributes<'_>), Point>)

source§

fn add_polygon( &mut self, polygon: Polygon<'_, Point>, attributes: Attributes<'_>, )

Adds a sub-path from a polygon. Read more
source§

fn add_point(&mut self, at: Point, attributes: Attributes<'_>) -> EndpointId

Adds a sub-path containing a single point. Read more
source§

fn add_line_segment( &mut self, line: &LineSegment<f32>, attributes: Attributes<'_>, ) -> (EndpointId, EndpointId)

Adds a sub-path containing a single line segment. Read more
source§

fn add_ellipse( &mut self, center: Point, radii: Vector, x_rotation: Angle, winding: Winding, attributes: Attributes<'_>, )

Adds a sub-path containing an ellipse. Read more
source§

fn add_circle( &mut self, center: Point, radius: f32, winding: Winding, attributes: Attributes<'_>, )
where Self: Sized,

Adds a sub-path containing a circle. Read more
source§

fn add_rectangle( &mut self, rect: &Box2D, winding: Winding, attributes: Attributes<'_>, )

Adds a sub-path containing a rectangle. Read more
source§

fn add_rounded_rectangle( &mut self, rect: &Box2D, radii: &BorderRadii, winding: Winding, custom_attributes: Attributes<'_>, )
where Self: Sized,

Adds a sub-path containing a rectangle. Read more
source§

fn flattened(self, tolerance: f32) -> Flattened<Self>
where Self: Sized,

Returns a builder that approximates all curves with sequences of line segments.
source§

fn transformed<Transform>( self, transform: Transform, ) -> Transformed<Self, Transform>
where Self: Sized, Transform: Transformation<f32>,

Returns a builder that applies the given transformation to all positions.
source§

fn with_svg(self) -> WithSvg<Self>
where Self: Sized,

Returns a builder that support SVG commands. Read more
source§

impl<B: PathBuilder> StructuralPartialEq for NoAttributes<B>

Auto Trait Implementations§

§

impl<B> Freeze for NoAttributes<B>
where B: Freeze,

§

impl<B> RefUnwindSafe for NoAttributes<B>
where B: RefUnwindSafe,

§

impl<B> Send for NoAttributes<B>
where B: Send,

§

impl<B> Sync for NoAttributes<B>
where B: Sync,

§

impl<B> Unpin for NoAttributes<B>
where B: Unpin,

§

impl<B> UnwindSafe for NoAttributes<B>
where B: UnwindSafe,

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> CloneToUninit for T
where T: Clone,

source§

unsafe fn clone_to_uninit(&self, dst: *mut T)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dst. 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> ToOwned for T
where T: Clone,

source§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
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.