Skip to main content

InlineFlow

Struct InlineFlow 

Source
pub struct InlineFlow<'a> { /* private fields */ }
Expand description

富文本内联真实组件流(InlineFlow): 允许在自动换行的段落流中无缝混排多色文字、彩色 Emoji 与任意真实交互组件(Button / Badge / Tag / Kbd 等)。

Implementations§

Source§

impl<'a> InlineFlow<'a>

Source

pub fn w(self, w: i16) -> Self

Source

pub fn w_full(self) -> Self

Source

pub fn gap(self, px: i8) -> Self

Source

pub const fn default_size(self, px: u8) -> Self

Source

pub const fn default_color(self, color: Color) -> Self

Source

pub fn text(self, cx: &'a FrameScope, content: &'a str) -> Self

追加一段可自动按词/CJK 字符边界拆行并与内联组件混排的文本。

Source

pub fn styled_text( self, cx: &'a FrameScope, content: &'a str, color: Color, font_size: u8, bold: bool, ) -> Self

追加一段带自定义颜色/字号/加粗的混排文本(自动按空格与 CJK 边界切分,确保丝滑换行)。

Source

pub fn inline_widget( self, cx: &'a FrameScope, widget: impl IntoElement<'a>, ) -> Self

追加任意真实可交互组件(如 Button、Badge、Tag、Kbd、图标、迷你进度条)作为行内原子元素。

Source

pub fn build(self) -> Div<'a>

完成构建并输出底层 crate::element::Div。

Trait Implementations§

Source§

impl<'a> IntoElement<'a> for InlineFlow<'a>

Source§

fn into_element(self, cx: &'a FrameScope) -> Element<'a>

Source§

fn into_any_element(self, cx: &'a FrameScope) -> Element<'a>

与 GPUI .into_any_element() 对应的语义别名(零堆分配返回闭合枚举 Element<'a>)。

Auto Trait Implementations§

§

impl<'a> !RefUnwindSafe for InlineFlow<'a>

§

impl<'a> !Send for InlineFlow<'a>

§

impl<'a> !Sync for InlineFlow<'a>

§

impl<'a> !UnwindSafe for InlineFlow<'a>

§

impl<'a> Forget for InlineFlow<'a>

§

impl<'a> Freeze for InlineFlow<'a>

§

impl<'a> Move for InlineFlow<'a>

§

impl<'a> Unpin for InlineFlow<'a>

§

impl<'a> UnsafeUnpin for InlineFlow<'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<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> FluentBuilder for T

Source§

fn when(self, condition: bool, then: impl FnOnce(Self) -> Self) -> Self

当 condition 为 true 时执行闭包修饰自身,否则原样返回。
Source§

fn when_else( self, condition: bool, then: impl FnOnce(Self) -> Self, else_fn: impl FnOnce(Self) -> Self, ) -> Self

根据 condition 在两个修饰分支之间二选一。
Source§

fn when_some<O>( self, option: Option<O>, then: impl FnOnce(Self, O) -> Self, ) -> Self

当 option 为 Some(value) 时执行闭包修饰自身,否则原样返回。
Source§

fn when_none<O>( self, option: &Option<O>, then: impl FnOnce(Self) -> Self, ) -> Self

当 option 为 None 时执行闭包修饰自身,否则原样返回。
Source§

fn apply<U>(self, f: impl FnOnce(Self) -> U) -> U

通用管道映射变换(避免与 Iterator::map / Option::map 重名)。
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> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

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.