Skip to main content

TextPathSegmentEllipsis

Struct TextPathSegmentEllipsis 

Source
pub struct TextPathSegmentEllipsis { /* private fields */ }
Expand description

Provides text collapsing properties that replace the middle segments of a file path with an ellipsis symbol when the rendered width exceeds a specified limit.

This class is typically used to display file paths in a compact form by collapsing segments near the center and inserting an ellipsis, ensuring that the most relevant parts of the path remain visible. It is suitable for scenarios where space is limited, such as UI elements that display file or directory paths. The collapsing behavior prioritizes preserving the beginning and end segments of the path.

Implementations§

Source§

impl TextPathSegmentEllipsis

Source

pub fn new( ellipsis: &str, width: f64, text_run_properties: Rc<dyn TextRunProperties>, flow_direction: FlowDirection, ) -> Self

Initializes a new instance with the specified ellipsis symbol, maximum width, text run properties, and flow direction.

  • ellipsis — the string to use as the ellipsis symbol when collapsing path segments.
  • width — the maximum width, in device-independent pixels, within which the text must fit.
  • text_run_properties — the text formatting properties to apply to the ellipsis symbol.
  • flow_direction — the flow direction for text layout.

Trait Implementations§

Source§

impl TextCollapsingProperties for TextPathSegmentEllipsis

Source§

fn width(&self) -> f64

Gets the width in which the collapsible range is constrained to.
Source§

fn symbol(&self) -> &Rc<dyn TextRun>

Gets the text run that is used as collapsing symbol.
Source§

fn flow_direction(&self) -> FlowDirection

Gets the flow direction that is used for collapsing.
Source§

fn collapse(&self, text_line: &dyn TextLine) -> Option<Vec<Rc<dyn TextRun>>>

Collapses given text line. Returns the collapsed runs, or None when the line does not have to be collapsed.

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> ClassDefaults for T
where T: ?Sized,

Source§

fn static_constructor()

The static constructor of a type: work done once per thread, after the properties of the type are registered and before its first instance exists (class handlers, affects_render, metadata overrides). 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 = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

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.