Struct lyon_path::commands::PathCommands
source · [−]pub struct PathCommands { /* private fields */ }
Expand description
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
sourceimpl PathCommands
impl PathCommands
sourcepub fn builder() -> PathCommandsBuilder
pub fn builder() -> PathCommandsBuilder
Creates a PathCommandsBuilder to create path commands.
sourcepub fn iter(&self) -> Iter<'_>ⓘNotable traits for Iter<'l>impl<'l> Iterator for Iter<'l> type Item = IdEvent;
pub fn iter(&self) -> Iter<'_>ⓘNotable traits for Iter<'l>impl<'l> Iterator for Iter<'l> type Item = IdEvent;
Returns an iterator over the path commands.
sourcepub fn as_slice(&self) -> PathCommandsSlice<'_>
pub fn as_slice(&self) -> PathCommandsSlice<'_>
Returns a view on the path commands.
sourcepub fn path_slice<'l, Endpoint, ControlPoint>(
&'l self,
endpoints: &'l [Endpoint],
control_points: &'l [ControlPoint]
) -> CommandsPathSlice<'_, Endpoint, ControlPoint>
pub fn path_slice<'l, Endpoint, ControlPoint>(
&'l self,
endpoints: &'l [Endpoint],
control_points: &'l [ControlPoint]
) -> CommandsPathSlice<'_, Endpoint, ControlPoint>
Returns a view on a path made of these commands with endpoint and control point slices.
sourcepub 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>;
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>;
Returns an iterator over the path, with endpoints and control points.
sourcepub fn next_event_id_in_path(&self, id: EventId) -> Option<EventId>
pub fn next_event_id_in_path(&self, id: EventId) -> Option<EventId>
Returns the next event id within the path.
sourcepub fn next_event_id_in_sub_path(&self, id: EventId) -> EventId
pub fn next_event_id_in_sub_path(&self, id: EventId) -> EventId
Returns the next event id within the sub-path.
Loops back to the first event after the end of the sub-path.
Trait Implementations
sourceimpl Clone for PathCommands
impl Clone for PathCommands
sourcefn clone(&self) -> PathCommands
fn clone(&self) -> PathCommands
Returns a copy of the value. Read more
1.0.0 · sourcefn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source
. Read more
sourceimpl Debug for PathCommands
impl Debug for PathCommands
sourceimpl<'l> From<&'l PathCommands> for PathCommandsSlice<'l>
impl<'l> From<&'l PathCommands> for PathCommandsSlice<'l>
sourcefn from(commands: &'l PathCommands) -> Self
fn from(commands: &'l PathCommands) -> Self
Converts to this type from the input type.
sourceimpl<'l> IntoIterator for &'l PathCommands
impl<'l> IntoIterator for &'l PathCommands
type Item = Event<EndpointId, ControlPointId>
type Item = Event<EndpointId, ControlPointId>
The type of the elements being iterated over.
Auto Trait Implementations
impl RefUnwindSafe for PathCommands
impl Send for PathCommands
impl Sync for PathCommands
impl Unpin for PathCommands
impl UnwindSafe for PathCommands
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more