#![doc(html_logo_url = "https://nical.github.io/lyon-doc/lyon-logo.svg")]
#![deny(bare_trait_objects)]
pub extern crate lyon_geom as geom;
#[cfg(feature = "serialization")]
#[macro_use]
pub extern crate serde;
mod events;
mod path_state;
mod path;
pub mod iterator;
pub mod builder;
pub use path::*;
pub use events::*;
pub use path_state::*;
pub use geom::ArcFlags;
pub use geom::math as math;
use std::ops::{Add, Sub};
use std::u32;
pub type Index = u32;
#[derive(Copy, Clone, Debug, PartialEq, Eq, Hash)]
#[cfg_attr(feature = "serialization", derive(Serialize, Deserialize))]
pub struct VertexId(pub Index);
impl VertexId {
pub const INVALID: VertexId = VertexId(u32::MAX);
pub fn offset(&self) -> Index { self.0 }
pub fn to_usize(&self) -> usize { self.0 as usize }
pub fn from_usize(v: usize) -> Self { VertexId(v as Index) }
}
impl Add<u32> for VertexId {
type Output = Self;
fn add(self, rhs: u32) -> Self {
VertexId(self.0 + rhs)
}
}
impl Sub<u32> for VertexId {
type Output = Self;
fn sub(self, rhs: u32) -> Self {
VertexId(self.0 - rhs)
}
}
impl From<u16> for VertexId {
fn from(v: u16) -> Self { VertexId(v as Index) }
}
impl From<u32> for VertexId {
fn from(v: u32) -> Self { VertexId(v) }
}
impl From<i32> for VertexId {
fn from(v: i32) -> Self { VertexId(v as Index) }
}
impl From<VertexId> for u16 {
fn from(v: VertexId) -> Self { v.0 as u16 }
}
impl From<VertexId> for u32 {
fn from(v: VertexId) -> Self { v.0 }
}
impl From<VertexId> for i32 {
fn from(v: VertexId) -> Self { v.0 as i32 }
}
impl From<VertexId> for usize {
fn from(v: VertexId) -> Self { v.0 as usize }
}