Skip to main content

Line

Struct Line 

Source
pub struct Line<'a> {
    pub style: Style,
    /* private fields */
}
Expand description

Connected line-segment widget backed by a borrowed point slice.

The lifetime parameter ties the widget to its point storage. The widget never stores raw pointers and never copies the point slice.

Fields§

§style: Style

Style used for the line stroke.

border_color supplies the stroke color, border_width supplies the stroke width in pixels, and alpha modulates the final stroke alpha.

Implementations§

Source§

impl<'a> Line<'a>

Source

pub fn new(bounds: Rect, points: &'a [Point]) -> Self

Create a line widget with borrowed point storage.

The default stroke is one pixel wide using Style::default’s border color so a newly created line is visible without additional styling.

Source

pub fn points(&self) -> &'a [Point]

Return the currently borrowed point slice.

Source

pub fn set_points(&mut self, points: &'a [Point])

Replace the borrowed point slice.

Source

pub fn set_y_invert(&mut self, y_invert: bool)

Enable or disable bottom-origin y coordinate mapping.

Source

pub fn y_invert(&self) -> bool

Return whether bottom-origin y coordinate mapping is enabled.

Trait Implementations§

Source§

impl<'a> Debug for Line<'a>

Source§

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

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

impl Widget for Line<'_>

Source§

fn bounds(&self) -> Rect

Return the area this widget occupies relative to its parent.
Source§

fn draw(&self, renderer: &mut dyn Renderer)

Render the widget using the provided Renderer.
Source§

fn handle_event(&mut self, _event: &Event) -> bool

Handle an event and return true if it was consumed. Read more
Source§

fn set_bounds(&mut self, bounds: Rect)

Called by the LPAR-10 layout pass to notify this widget of its layout-computed bounds. Read more
Source§

fn clear_region(&mut self) -> Option<Rect>

Return a region (in draw/landscape coordinates) that should be restored from the pristine background copy, or None. Read more
Source§

fn widget_font_mut(&mut self) -> Option<&mut WidgetFont>

Expose this widget’s font slot for cascade-driven font resolution (FONT-05 §5.B). Read more

Auto Trait Implementations§

§

impl<'a> Freeze for Line<'a>

§

impl<'a> RefUnwindSafe for Line<'a>

§

impl<'a> Send for Line<'a>

§

impl<'a> Sync for Line<'a>

§

impl<'a> Unpin for Line<'a>

§

impl<'a> UnsafeUnpin for Line<'a>

§

impl<'a> UnwindSafe for Line<'a>

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.