pub struct InlineFlow<'a> { /* private fields */ }Expand description
富文本内联真实组件流(InlineFlow):
允许在自动换行的段落流中无缝混排多色文字、彩色 Emoji 与任意真实交互组件(Button / Badge / Tag / Kbd 等)。
Implementations§
Source§impl<'a> InlineFlow<'a>
impl<'a> InlineFlow<'a>
pub fn w(self, w: i16) -> Self
pub fn w_full(self) -> Self
pub fn gap(self, px: i8) -> Self
pub const fn default_size(self, px: u8) -> Self
pub const fn default_color(self, color: Color) -> Self
Sourcepub fn text(self, cx: &'a FrameScope, content: &'a str) -> Self
pub fn text(self, cx: &'a FrameScope, content: &'a str) -> Self
追加一段可自动按词/CJK 字符边界拆行并与内联组件混排的文本。
Sourcepub fn styled_text(
self,
cx: &'a FrameScope,
content: &'a str,
color: Color,
font_size: u8,
bold: bool,
) -> Self
pub fn styled_text( self, cx: &'a FrameScope, content: &'a str, color: Color, font_size: u8, bold: bool, ) -> Self
追加一段带自定义颜色/字号/加粗的混排文本(自动按空格与 CJK 边界切分,确保丝滑换行)。
Sourcepub fn inline_widget(
self,
cx: &'a FrameScope,
widget: impl IntoElement<'a>,
) -> Self
pub fn inline_widget( self, cx: &'a FrameScope, widget: impl IntoElement<'a>, ) -> Self
追加任意真实可交互组件(如 Button、Badge、Tag、Kbd、图标、迷你进度条)作为行内原子元素。
Sourcepub fn build(self) -> Div<'a>
pub fn build(self) -> Div<'a>
完成构建并输出底层 crate::element::Div。
Trait Implementations§
Source§impl<'a> IntoElement<'a> for InlineFlow<'a>
impl<'a> IntoElement<'a> for InlineFlow<'a>
fn into_element(self, cx: &'a FrameScope) -> Element<'a>
Source§fn into_any_element(self, cx: &'a FrameScope) -> Element<'a>
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> 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
Mutably borrows from an owned value. Read more
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> FluentBuilder for T
impl<T> FluentBuilder for T
Source§fn when(self, condition: bool, then: impl FnOnce(Self) -> Self) -> Self
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
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
fn when_some<O>( self, option: Option<O>, then: impl FnOnce(Self, O) -> Self, ) -> Self
当
option 为 Some(value) 时执行闭包修饰自身,否则原样返回。