PinInfo

Struct PinInfo 

Source
pub struct PinInfo {
    pub shape: Option<PinShape>,
    pub fill: Option<Color32>,
    pub stroke: Option<Stroke>,
    pub wire_color: Option<Color32>,
    pub wire_style: Option<WireStyle>,
    pub position: Option<f32>,
}
Expand description

Information about a pin returned by TreeizeViewer::show_input and TreeizeViewer::show_output.

All fields are optional. If a field is None, the default value is used derived from the graph style.

Fields§

§shape: Option<PinShape>

Shape of the pin.

§fill: Option<Color32>

Fill color of the pin.

§stroke: Option<Stroke>

Outline stroke of the pin.

§wire_color: Option<Color32>

Color of the wire connected to the pin. If None, the pin’s fill color is used.

§wire_style: Option<WireStyle>

Style of the wire connected to the pin.

§position: Option<f32>

Custom vertical position of a pin

Implementations§

Source§

impl PinInfo

Source

pub const fn with_shape(self, shape: PinShape) -> Self

Sets the shape of the pin.

Source

pub const fn with_fill(self, fill: Color32) -> Self

Sets the fill color of the pin.

Source

pub const fn with_stroke(self, stroke: Stroke) -> Self

Sets the outline stroke of the pin.

Source

pub const fn with_wire_style(self, wire_style: WireStyle) -> Self

Sets the style of the wire connected to the pin.

Source

pub const fn with_wire_color(self, wire_color: Color32) -> Self

Sets the color of the wire connected to the pin.

Source

pub fn circle() -> Self

Creates a circle pin.

Source

pub fn triangle() -> Self

Creates a triangle pin.

Source

pub fn square() -> Self

Creates a square pin.

Source

pub fn star() -> Self

Creates a star pin.

Source

pub fn get_shape(&self, treeize_style: &TreeizeStyle) -> PinShape

Returns the shape of the pin.

Source

pub fn get_fill(&self, treeize_style: &TreeizeStyle, style: &Style) -> Color32

Returns fill color of the pin.

Source

pub fn get_stroke(&self, treeize_style: &TreeizeStyle, style: &Style) -> Stroke

Returns outline stroke of the pin.

Source

pub fn draw( &self, treeize_style: &TreeizeStyle, style: &Style, rect: Rect, painter: &Painter, ) -> PinWireInfo

Draws the pin and returns color.

Wires are drawn with returned color by default.

Trait Implementations§

Source§

impl Default for PinInfo

Source§

fn default() -> PinInfo

Returns the “default value” for a type. Read more
Source§

impl TreeizePin for PinInfo

Source§

fn draw( self, treeize_style: &TreeizeStyle, style: &Style, rect: Rect, painter: &Painter, ) -> PinWireInfo

Draws the pin. Read more
Source§

fn pin_rect(&self, x0: f32, x1: f32, y: f32, size: f32) -> Rect

Calculates pin Rect from the given parameters.

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