Enum Fragment

Source
pub enum Fragment {
    Line(Line),
    MarkerLine(MarkerLine),
    Circle(Circle),
    Arc(Arc),
    Polygon(Polygon),
    Rect(Rect),
    CellText(CellText),
    Text(Text),
}
Expand description
     0 1 2 3 4           B C D
    0┌─┬─┬─┬─┐        A┌─┬─┬─┬─┐E
    1├─┼─┼─┼─┤         │ │ │ │ │
    2├─┼─┼─┼─┤        F├─G─H─I─┤J
    3├─┼─┼─┼─┤         │ │ │ │ │
    4├─┼─┼─┼─┤        K├─L─M─N─┤O
    5├─┼─┼─┼─┤         │ │ │ │ │
    6├─┼─┼─┼─┤        P├─Q─R─S─┤T
    7├─┼─┼─┼─┤         │ │ │ │ │
    8└─┴─┴─┴─┘        U└─┴─┴─┴─┘Y
```                      V W X

Variants§

§

Line(Line)

§

MarkerLine(MarkerLine)

§

Circle(Circle)

§

Arc(Arc)

§

Polygon(Polygon)

§

Rect(Rect)

§

CellText(CellText)

§

Text(Text)

Implementations§

Source§

impl Fragment

Source

pub fn match_unicode(fragments: &[Fragment]) -> Option<char>

get the character that matches the shape present on this cell

Source

pub fn hit(&self, start: Point, end: Point) -> bool

Source

pub fn is_intersecting(&self, bbox: &Aabb) -> bool

check if this fragment is intersecting with this bounding box Note: if intersection logic requires testing the solid shape inside the polygon use the ConvexPolygon of each shape instead of Polyline

Source

pub fn is_inside(&self, bbox: &Aabb) -> bool

check if this fragment can be contain in the specified bounding box bbox

Source

pub fn absolute_position(&self, cell: Cell) -> Self

recompute the end points of this fragment offset by the cell location

Source

pub fn scale(&self, scale: f32) -> Self

enlarge or shrink this fragment at scale

Source

pub fn align(&self) -> Self

Source

pub fn as_line(&self) -> Option<&Line>

Source

pub fn as_rect(&self) -> Option<&Rect>

Source

pub fn as_polygon(&self) -> Option<&Polygon>

Source

pub fn as_arc(&self) -> Option<&Arc>

Source

pub fn as_cell_text(&self) -> Option<&CellText>

Source

pub fn as_text(&self) -> Option<&Text>

Source

pub fn as_css_tag(&self) -> Vec<String>

if this is a cell text and is wrapped in braces then it is a css tag for the container

Source

pub fn as_circle(&self) -> Option<&Circle>

Source

pub fn is_circle(&self) -> bool

Source

pub fn is_rect(&self) -> bool

Source

pub fn is_text(&self) -> bool

Source

pub fn is_cell_text(&self) -> bool

Source

pub fn is_broken(&self) -> bool

Trait Implementations§

Source§

impl Bounds for Fragment

Source§

fn bounds(&self) -> (Point, Point)

Source§

fn mins(&self) -> Point

Source§

fn maxs(&self) -> Point

Source§

impl Clone for Fragment

Source§

fn clone(&self) -> Fragment

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 Debug for Fragment

Source§

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

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

impl Display for Fragment

Source§

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

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

impl From<Arc> for Fragment

Source§

fn from(arc: Arc) -> Self

Converts to this type from the input type.
Source§

impl From<CellText> for Fragment

Source§

fn from(ct: CellText) -> Fragment

Converts to this type from the input type.
Source§

impl From<Circle> for Fragment

Source§

fn from(circle: Circle) -> Self

Converts to this type from the input type.
Source§

impl<MSG> From<Fragment> for Node<MSG>

Source§

fn from(fragment: Fragment) -> Node<MSG>

Converts to this type from the input type.
Source§

impl From<Line> for Fragment

Source§

fn from(line: Line) -> Self

Converts to this type from the input type.
Source§

impl From<Rect> for Fragment

Source§

fn from(rect: Rect) -> Self

Converts to this type from the input type.
Source§

impl From<Text> for Fragment

Source§

fn from(text: Text) -> Self

Converts to this type from the input type.
Source§

impl Merge for Fragment

Source§

fn merge(&self, other: &Self) -> Option<Self>

merge this fragment to the other fragment if it is possible returns None if the fragment can not be merge

Source§

fn merge_recursive(items: impl IntoIterator<Item = Self>) -> Vec<Self>
where Self: Sized,

Merge all items until the size don’t change
Source§

fn second_pass_merge(items: impl IntoIterator<Item = Self>) -> Vec<Self>
where Self: Sized,

Iterate through each items in the group and merge that items that can be merged
Source§

impl Ord for Fragment

Source§

fn cmp(&self, other: &Self) -> Ordering

This method returns an Ordering between self and other. Read more
1.21.0 · Source§

fn max(self, other: Self) -> Self
where Self: Sized,

Compares and returns the maximum of two values. Read more
1.21.0 · Source§

fn min(self, other: Self) -> Self
where Self: Sized,

Compares and returns the minimum of two values. Read more
1.50.0 · Source§

fn clamp(self, min: Self, max: Self) -> Self
where Self: Sized,

Restrict a value to a certain interval. Read more
Source§

impl PartialEq for Fragment

Source§

fn eq(&self, other: &Self) -> 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 PartialOrd for Fragment

Source§

fn partial_cmp(&self, other: &Self) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · Source§

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

Tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · Source§

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

Tests less than or equal to (for self and other) and is used by the <= operator. Read more
1.0.0 · Source§

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

Tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 · Source§

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

Tests greater than or equal to (for self and other) and is used by the >= operator. Read more
Source§

impl Eq for Fragment

Auto Trait Implementations§

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, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<Q, K> Comparable<K> for Q
where Q: Ord + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn compare(&self, key: &K) -> Ordering

Compare self to key and return their ordering.
Source§

impl<T> Downcast for T
where T: Any,

Source§

fn into_any(self: Box<T>) -> Box<dyn Any>

Convert Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.
Source§

fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>

Convert Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be further downcast into Rc<ConcreteType> where ConcreteType implements Trait.
Source§

fn as_any(&self) -> &(dyn Any + 'static)

Convert &Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot generate &Any’s vtable from &Trait’s.
Source§

fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)

Convert &mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot generate &mut Any’s vtable from &mut Trait’s.
Source§

impl<T> DowncastSync for T
where T: Any + Send + Sync,

Source§

fn into_any_arc(self: Arc<T>) -> Arc<dyn Any + Sync + Send>

Convert Arc<Trait> (where Trait: Downcast) to Arc<Any>. Arc<Any> can then be further downcast into Arc<ConcreteType> where ConcreteType implements Trait.
Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
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> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts 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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts 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
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<SS, SP> SupersetOf<SS> for SP
where SS: SubsetOf<SP>,

Source§

fn to_subset(&self) -> Option<SS>

The inverse inclusion map: attempts to construct self from the equivalent element of its superset. Read more
Source§

fn is_in_subset(&self) -> bool

Checks if self is actually part of its subset T (and can be converted to it).
Source§

fn to_subset_unchecked(&self) -> SS

Use with care! Same as self.to_subset but without any property checks. Always succeeds.
Source§

fn from_subset(element: &SS) -> SP

The inclusion map: converts self to the equivalent element of its superset.
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> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. 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.
Source§

impl<T> Scalar for T
where T: 'static + Clone + PartialEq + Debug,