Skip to main content

Connector

Struct Connector 

Source
pub struct Connector {
Show 14 fields pub connector_type: ConnectorType, pub start_x: u32, pub start_y: u32, pub end_x: u32, pub end_y: u32, pub line: ConnectorLine, pub start_arrow: ArrowType, pub end_arrow: ArrowType, pub arrow_size: ArrowSize, pub start_shape_id: Option<u32>, pub start_site: Option<ConnectionSite>, pub end_shape_id: Option<u32>, pub end_site: Option<ConnectionSite>, pub label: Option<String>,
}
Expand description

Connector definition

Fields§

§connector_type: ConnectorType

Connector type

§start_x: u32

Start X position in EMU

§start_y: u32

Start Y position in EMU

§end_x: u32

End X position in EMU

§end_y: u32

End Y position in EMU

§line: ConnectorLine

Line style

§start_arrow: ArrowType

Start arrow

§end_arrow: ArrowType

End arrow

§arrow_size: ArrowSize

Arrow size

§start_shape_id: Option<u32>

Connected shape ID at start (optional)

§start_site: Option<ConnectionSite>

Connection site at start shape

§end_shape_id: Option<u32>

Connected shape ID at end (optional)

§end_site: Option<ConnectionSite>

Connection site at end shape

§label: Option<String>

Optional label text

Implementations§

Source§

impl Connector

Source

pub fn new( connector_type: ConnectorType, start_x: u32, start_y: u32, end_x: u32, end_y: u32, ) -> Self

Create a new connector

Source

pub fn straight(start_x: u32, start_y: u32, end_x: u32, end_y: u32) -> Self

Create a straight connector

Source

pub fn elbow(start_x: u32, start_y: u32, end_x: u32, end_y: u32) -> Self

Create an elbow connector

Source

pub fn curved(start_x: u32, start_y: u32, end_x: u32, end_y: u32) -> Self

Create a curved connector

Source

pub fn with_line(self, line: ConnectorLine) -> Self

Set line style

Source

pub fn with_color(self, color: &str) -> Self

Set line color

Source

pub fn with_width(self, width: u32) -> Self

Set line width in EMU

Source

pub fn with_start_arrow(self, arrow: ArrowType) -> Self

Set start arrow

Source

pub fn with_end_arrow(self, arrow: ArrowType) -> Self

Set end arrow

Source

pub fn with_arrows(self, start: ArrowType, end: ArrowType) -> Self

Set both arrows

Source

pub fn with_arrow_size(self, size: ArrowSize) -> Self

Set arrow size

Source

pub fn connect_start(self, shape_id: u32, site: ConnectionSite) -> Self

Connect to start shape

Source

pub fn connect_end(self, shape_id: u32, site: ConnectionSite) -> Self

Connect to end shape

Source

pub fn with_label(self, label: &str) -> Self

Add label text

Trait Implementations§

Source§

impl Clone for Connector

Source§

fn clone(&self) -> Connector

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

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

Performs copy-assignment from source. Read more
Source§

impl Debug for Connector

Source§

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

Formats the value using the given formatter. Read more

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> Same for T

Source§

type Output = T

Should always be Self
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.