[][src]Struct lyon_path::PathCommands

pub struct PathCommands { /* fields omitted */ }

The commands of a path encoded in a single array using IDs to refer to endpoints and control points externally.

PathCommands is a good fit when the a custom endpoint and control point types are needed or when their the user needs full control over their storage.

Representation

Path commands contains a single array of 32 bits integer values encoding path commands, endpoint IDs or control point IDs.

 __________________________________________________________________________
|       |          |      |          |         |              |          |
| Begin |EndpointID| Line |EndpointID|Quadratic|ControlPointId|EndpointID| ...
|_______|__________|______|__________|_________|______________|__________|_

Example

use lyon_path::{EndpointId, PathCommands};

let mut cmds = PathCommands::builder();

cmds.begin(EndpointId(0));
cmds.line_to(EndpointId(1));
cmds.line_to(EndpointId(2));
cmds.end(true);

let cmds = cmds.build();

Implementations

impl PathCommands[src]

pub fn builder() -> PathCommandsBuilder[src]

Creates a PathCommandsBuilder to create path commands.

pub fn iter(&self) -> Iter<'_>

Notable traits for Iter<'l>

impl<'l> Iterator for Iter<'l> type Item = IdEvent;
[src]

Returns an iterator over the path commands.

pub fn as_slice(&self) -> PathCommandsSlice<'_>[src]

Returns a view on the path commands.

pub fn path_slice<'l, Endpoint, ControlPoint>(
    &'l self,
    endpoints: &'l [Endpoint],
    control_points: &'l [ControlPoint]
) -> CommandsPathSlice<'_, Endpoint, ControlPoint>
[src]

Returns a view on a path made of these commands with endpoint and control point slices.

pub fn events<'l, Endpoint, ControlPoint>(
    &'l self,
    endpoints: &'l [Endpoint],
    control_points: &'l [ControlPoint]
) -> Events<'_, Endpoint, ControlPoint>

Notable traits for Events<'l, Endpoint, ControlPoint>

impl<'l, Endpoint, ControlPoint> Iterator for Events<'l, Endpoint, ControlPoint> type Item = Event<&'l Endpoint, &'l ControlPoint>;
[src]

Returns an iterator over the path, with endpoints and control points.

pub fn event(&self, id: EventId) -> IdEvent[src]

Returns the event for a given event ID.

pub fn next_event_id_in_path(&self, id: EventId) -> Option<EventId>[src]

Returns the next event id within the path.

pub fn next_event_id_in_sub_path(&self, id: EventId) -> EventId[src]

Returns the next event id within the sub-path.

Loops back to the first event after the end of the sub-path.

Trait Implementations

impl Clone for PathCommands[src]

impl Debug for PathCommands[src]

impl<'l> Into<PathCommandsSlice<'l>> for &'l PathCommands[src]

impl<'l> IntoIterator for &'l PathCommands[src]

type Item = IdEvent

The type of the elements being iterated over.

type IntoIter = Iter<'l>

Which kind of iterator are we turning this into?

Auto Trait Implementations

Blanket Implementations

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

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

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

impl<T> From<T> for T[src]

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

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

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

type Error = Infallible

The type returned in the event of a conversion error.

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

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

The type returned in the event of a conversion error.