Struct Element

Source
pub struct Element {
    pub shape: ShapeKind,
    pub pos: Position,
    pub look: StyleAttr,
    pub orientation: Orientation,
    pub properties: Option<String>,
}

Fields§

§shape: ShapeKind§pos: Position§look: StyleAttr§orientation: Orientation§properties: Option<String>

Implementations§

Source§

impl Element

Source

pub fn create( shape: ShapeKind, look: StyleAttr, orientation: Orientation, size: Point, ) -> Element

Source

pub fn create_with_properties( shape: ShapeKind, look: StyleAttr, orientation: Orientation, size: Point, properties: impl Into<String>, ) -> Element

Source

pub fn create_connector( label: &str, look: &StyleAttr, dir: Orientation, ) -> Element

Source

pub fn empty_connector(dir: Orientation) -> Element

Source

pub fn move_to(&mut self, to: Point)

Trait Implementations§

Source§

impl Clone for Element

Source§

fn clone(&self) -> Element

Returns a duplicate of the value. Read more
1.0.0 · Source§

const fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Element

Source§

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

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

impl Renderable for Element

Source§

fn render(&self, debug: bool, canvas: &mut dyn RenderBackend)

Render the shape into a canvas. If \p debug is set then extra markers will be rendered.
Source§

fn get_connector_location( &self, from: Point, force: f64, port: &Option<String>, ) -> (Point, Point)

\Return the coordinate for the connection point of an arrow that’s coming from the direction of \p from. The format of the path is (x, y, cx, cy), where cx and cy, are the control points of the bezier curve. \p force is the magnitude of the edge direction. \p port is the optional port name (for named records).
Source§

fn get_passthrough_path( &self, _from: Point, _to: Point, _force: f64, ) -> (Point, Point)

Computes the coordinate for the connection point of an arrow that’s passing through this edge. coming from the direction of \p from. \returns the bezier path in the format (x, y, cx, cy), where cx and cy, are the control points for the entry path of the bezier curve. The exit path is assumed to be the mirror point for the center (first point). \p force is the magnitude of the edge direction. This works with the get_connector_location method for drawing edges.
Source§

impl Visible for Element

Source§

fn position(&self) -> Position

\return the Position of the shape.
Source§

fn position_mut(&mut self) -> &mut Position

\return the mutable reference to the Position of the shape.
Source§

fn is_connector(&self) -> bool

Return true if the element is a connector.
Source§

fn transpose(&mut self)

Swap the coordinates of the location and size.
Source§

fn resize(&mut self)

Update the size of the shape.

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<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> 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, 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.