pub struct Path {
commands: Box<[PackedCommand]>,
coords: Box<[f64]>,
}Expand description
An immutable path with a compact representation.
This is constructed from a PathBuilder once it is finished. You
can get an iterator for the path’s commands with the iter
method, or an iterator for its subpaths (subsequences of commands that
start with a MoveTo) with the iter_subpath method.
The variants in PathCommand have different sizes, so a simple array of PathCommand
would have a lot of slack space. We reduce this to a minimum by separating the
commands from their coordinates. Then, we can have two dense arrays: one with a compact
representation of commands, and another with a linear list of the coordinates for each
command.
Both PathCommand and PackedCommand know how many coordinates they ought to
produce, with their num_coordinates methods.
This struct implements Default, and it yields an empty path.
Fields§
§commands: Box<[PackedCommand]>§coords: Box<[f64]>Implementations§
Source§impl Path
impl Path
pub fn to_cairo_path( &self, is_square_linecap: bool, ) -> Result<CairoPath, Box<InternalRenderingError>>
pub fn to_cairo( &self, cr: &Context, is_square_linecap: bool, ) -> Result<(), Box<InternalRenderingError>>
Source§impl Path
impl Path
Sourcepub fn iter_subpath(&self) -> SubPathIter<'_> ⓘ
pub fn iter_subpath(&self) -> SubPathIter<'_> ⓘ
Get an iterator over a path Subpaths.
Sourcepub fn iter(&self) -> impl Iterator<Item = PathCommand> + '_
pub fn iter(&self) -> impl Iterator<Item = PathCommand> + '_
Get an iterator over a path’s commands.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Path
impl RefUnwindSafe for Path
impl Send for Path
impl Sync for Path
impl Unpin for Path
impl UnwindSafe for Path
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
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more§impl<T> Pointable for T
impl<T> Pointable for T
§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
self from the equivalent element of its
superset. Read more§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
self is actually part of its subset T (and can be converted to it).§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
self.to_subset but without any property checks. Always succeeds.§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
self to the equivalent element of its superset.