pub enum ShapeRef<'a> {
Block(BlockShape<'a>),
Port(PortShape<'a>),
Text(TextShape<'a>),
Area(&'a Area),
Image(Artwork<'a>),
}Expand description
A borrowed reference to any shape, bundled with whatever the geometry
layer needs beside the entity itself: a block’s pins, a port’s own id, a
text box’s measured extent, artwork’s bytes. Because this is a concrete
enum (not a trait object), methods with generic parameters (e.g.
with_pins) work naturally — dispatch is via match, not a vtable.
Variants§
Implementations§
Source§impl<'a> ShapeRef<'a>
impl<'a> ShapeRef<'a>
Sourcepub fn text(text: &'a Text, extent: Option<GridSize>) -> Self
pub fn text(text: &'a Text, extent: Option<GridSize>) -> Self
A free-floating text annotation with the extent it was last measured
at, or None to fall back on the character-count estimate.
Sourcepub fn artwork(rect: Rect, asset: Option<&'a Asset>) -> Self
pub fn artwork(rect: Rect, asset: Option<&'a Asset>) -> Self
A placed image or a block icon: the box it fills and the bytes behind its content hash, which the caller resolved from the document’s asset table.
pub fn gui_rect(&self) -> Rect
Sourcepub fn render_ng<R: Renderer>(
&self,
accents: ShapeAccents<'_>,
mode: RenderMode,
painter: &mut Style<'_, R>,
)
pub fn render_ng<R: Renderer>( &self, accents: ShapeAccents<'_>, mode: RenderMode, painter: &mut Style<'_, R>, )
accents is the derived pin-accent lookup, resolved by the caller
(who knows the shape’s scope); only ports consume it here — a block’s
pins draw in the deferred Self::render_pins_ng pass.
Sourcepub fn render_pins_ng<R: Renderer>(
&self,
accents: ShapeAccents<'_>,
mode: RenderMode,
painter: &mut Style<'_, R>,
)
pub fn render_pins_ng<R: Renderer>( &self, accents: ShapeAccents<'_>, mode: RenderMode, painter: &mut Style<'_, R>, )
Draw only a block’s deferred pin layer (see crate::widget::DrawingPasses).
Only blocks have pins to layer over their icon; every other shape draws
nothing.
pub fn with_pins(&self, f: impl FnMut(PinId, &'a Pin))
pub fn pin(&self, id: PinId) -> Option<&Pin>
pub fn pin_text_rect<R: Renderer>( &self, id: PinId, painter: &Style<'_, R>, ) -> Option<Rect>
pub fn pin_type_rect<R: Renderer>( &self, id: PinId, painter: &Style<'_, R>, ) -> Option<Rect>
pub fn tag_text_rect_for<R: Renderer>( &self, id: PinId, text: &str, painter: &Style<'_, R>, ) -> Option<Rect>
pub fn pin_stub_rect(&self, id: PinId) -> Option<Rect>
pub fn anchor_point_with_rect(&self, rect: Rect, id: PinId) -> Option<Pos2>
pub fn pin_drop_candidate( &self, pin_id: PinId, side: PinSide, raw_offset_px: f32, ) -> Option<u32>
pub fn title(&self) -> Option<ShapeLabel<'_>>
pub fn type_label(&self) -> Option<ShapeLabel<'_>>
pub fn title_anchor(&self) -> Option<Pos2>
pub fn resizable(&self) -> bool
pub fn constrain_resize_delta(&self, delta: Vec2) -> Vec2
Trait Implementations§
Auto Trait Implementations§
impl<'a> Freeze for ShapeRef<'a>
impl<'a> RefUnwindSafe for ShapeRef<'a>
impl<'a> Send for ShapeRef<'a>
impl<'a> Sync for ShapeRef<'a>
impl<'a> Unpin for ShapeRef<'a>
impl<'a> UnsafeUnpin for ShapeRef<'a>
impl<'a> UnwindSafe for ShapeRef<'a>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
§impl<D> OwoColorize for D
impl<D> OwoColorize for D
§fn fg<C>(&self) -> FgColorDisplay<'_, C, Self>where
C: Color,
fn fg<C>(&self) -> FgColorDisplay<'_, C, Self>where
C: Color,
§fn bg<C>(&self) -> BgColorDisplay<'_, C, Self>where
C: Color,
fn bg<C>(&self) -> BgColorDisplay<'_, C, Self>where
C: Color,
§fn on_magenta(&self) -> BgColorDisplay<'_, Magenta, Self>
fn on_magenta(&self) -> BgColorDisplay<'_, Magenta, Self>
§fn default_color(&self) -> FgColorDisplay<'_, Default, Self>
fn default_color(&self) -> FgColorDisplay<'_, Default, Self>
§fn on_default_color(&self) -> BgColorDisplay<'_, Default, Self>
fn on_default_color(&self) -> BgColorDisplay<'_, Default, Self>
§fn bright_black(&self) -> FgColorDisplay<'_, BrightBlack, Self>
fn bright_black(&self) -> FgColorDisplay<'_, BrightBlack, Self>
§fn on_bright_black(&self) -> BgColorDisplay<'_, BrightBlack, Self>
fn on_bright_black(&self) -> BgColorDisplay<'_, BrightBlack, Self>
§fn bright_red(&self) -> FgColorDisplay<'_, BrightRed, Self>
fn bright_red(&self) -> FgColorDisplay<'_, BrightRed, Self>
§fn on_bright_red(&self) -> BgColorDisplay<'_, BrightRed, Self>
fn on_bright_red(&self) -> BgColorDisplay<'_, BrightRed, Self>
§fn bright_green(&self) -> FgColorDisplay<'_, BrightGreen, Self>
fn bright_green(&self) -> FgColorDisplay<'_, BrightGreen, Self>
§fn on_bright_green(&self) -> BgColorDisplay<'_, BrightGreen, Self>
fn on_bright_green(&self) -> BgColorDisplay<'_, BrightGreen, Self>
§fn bright_yellow(&self) -> FgColorDisplay<'_, BrightYellow, Self>
fn bright_yellow(&self) -> FgColorDisplay<'_, BrightYellow, Self>
§fn on_bright_yellow(&self) -> BgColorDisplay<'_, BrightYellow, Self>
fn on_bright_yellow(&self) -> BgColorDisplay<'_, BrightYellow, Self>
§fn bright_blue(&self) -> FgColorDisplay<'_, BrightBlue, Self>
fn bright_blue(&self) -> FgColorDisplay<'_, BrightBlue, Self>
§fn on_bright_blue(&self) -> BgColorDisplay<'_, BrightBlue, Self>
fn on_bright_blue(&self) -> BgColorDisplay<'_, BrightBlue, Self>
§fn bright_magenta(&self) -> FgColorDisplay<'_, BrightMagenta, Self>
fn bright_magenta(&self) -> FgColorDisplay<'_, BrightMagenta, Self>
§fn on_bright_magenta(&self) -> BgColorDisplay<'_, BrightMagenta, Self>
fn on_bright_magenta(&self) -> BgColorDisplay<'_, BrightMagenta, Self>
§fn bright_purple(&self) -> FgColorDisplay<'_, BrightMagenta, Self>
fn bright_purple(&self) -> FgColorDisplay<'_, BrightMagenta, Self>
§fn on_bright_purple(&self) -> BgColorDisplay<'_, BrightMagenta, Self>
fn on_bright_purple(&self) -> BgColorDisplay<'_, BrightMagenta, Self>
§fn bright_cyan(&self) -> FgColorDisplay<'_, BrightCyan, Self>
fn bright_cyan(&self) -> FgColorDisplay<'_, BrightCyan, Self>
§fn on_bright_cyan(&self) -> BgColorDisplay<'_, BrightCyan, Self>
fn on_bright_cyan(&self) -> BgColorDisplay<'_, BrightCyan, Self>
§fn bright_white(&self) -> FgColorDisplay<'_, BrightWhite, Self>
fn bright_white(&self) -> FgColorDisplay<'_, BrightWhite, Self>
§fn on_bright_white(&self) -> BgColorDisplay<'_, BrightWhite, Self>
fn on_bright_white(&self) -> BgColorDisplay<'_, BrightWhite, Self>
§fn blink_fast(&self) -> BlinkFastDisplay<'_, Self>
fn blink_fast(&self) -> BlinkFastDisplay<'_, Self>
§fn strikethrough(&self) -> StrikeThroughDisplay<'_, Self>
fn strikethrough(&self) -> StrikeThroughDisplay<'_, Self>
§fn color<Color>(&self, color: Color) -> FgDynColorDisplay<'_, Color, Self>where
Color: DynColor,
fn color<Color>(&self, color: Color) -> FgDynColorDisplay<'_, Color, Self>where
Color: DynColor,
OwoColorize::fg] or
a color-specific method, such as [OwoColorize::green], Read more§fn on_color<Color>(&self, color: Color) -> BgDynColorDisplay<'_, Color, Self>where
Color: DynColor,
fn on_color<Color>(&self, color: Color) -> BgDynColorDisplay<'_, Color, Self>where
Color: DynColor,
OwoColorize::bg] or
a color-specific method, such as [OwoColorize::on_yellow], Read more