Skip to main content

Div

Struct Div 

Source
pub struct Div<'a> {
Show 47 fields pub id: Option<u32>, pub style: Style, pub margin: Edges<i16>, pub extra_padding: Edges<i16>, pub min_w: i16, pub max_w: i16, pub min_h: i16, pub max_h: i16, pub opacity: u8, pub active_bg: Option<Color>, pub hover_bg: Option<Color>, pub bg_grad: Option<(Color, bool)>, pub focus_border: Option<(u8, Color)>, pub focusable: bool, pub is_overlay: bool, pub occlude_hit: bool, pub auto_repeat: bool, pub scrollable_max: Option<i16>, pub pos: Option<(i16, i16)>, pub first_child: Option<&'a ElementNode<'a>>, pub last_child: Option<&'a ElementNode<'a>>, pub on_click: Option<&'a dyn Fn(&mut ActionScope<'_>)>, pub on_long_press: Option<&'a dyn Fn(&mut ActionScope<'_>)>, pub on_drag: Option<&'a dyn Fn(&mut ActionScope<'_>)>, pub on_hover: Option<&'a dyn Fn(bool, &mut ActionScope<'_>)>, pub on_pointer_move: Option<&'a dyn Fn(&mut ActionScope<'_>)>, pub on_swipe: Option<&'a dyn Fn(SwipeDir, &mut ActionScope<'_>)>, pub on_key_input: Option<&'a dyn Fn(KeyCode, &mut ActionScope<'_>)>, pub on_key_nav: Option<&'a dyn Fn(KeyCode, &mut ActionScope<'_>)>, pub on_navigate_back: Option<&'a dyn Fn(&mut ActionScope<'_>)>, pub on_secondary_click: Option<&'a dyn Fn(&mut ActionScope<'_>)>, pub z_index: i8, pub shadow: Option<(u8, i8, i8, Color)>, pub grid_cols: u8, pub transition: Option<TransitionSpec>, pub clip_children: bool, pub align_self: Option<AlignItems>, pub cursor: Option<CursorShape>, pub text_color: Option<Color>, pub text_size: Option<u8>, pub hover_style: Option<StyleRefinement>, pub active_style: Option<StyleRefinement>, pub focus_style: Option<StyleRefinement>, pub items_baseline: bool, pub effects: PaintEffects<'a>, pub external_texture: Option<ExternalTextureSpec>, pub layout_ext: LayoutExtras<'a>,
}
Expand description

基础弹性盒容器原语(完全复刻 HTML/Tailwind 的 div 直觉)。

Fields§

§id: Option<u32>

跨帧唯一 ID(驱动滚动位置记忆与 .animate_xxx() 过渡动画)。

§style: Style

紧凑位域样式(严格 24 Bytes)。

§margin: Edges<i16>

可选的四边独立外边距(配合 style.margin_px() 使用)。

§extra_padding: Edges<i16>

可选的大尺寸安全区或内边距扩展(像素,与 style.padding 叠加,避免移动端软键盘 > 127px 截断)。

§min_w: i16

最小宽度约束(0 表示不限)。

§max_w: i16

最大宽度约束(0 表示不限)。

§min_h: i16

最小高度约束(0 表示不限)。

§max_h: i16

最大高度约束(0 表示不限)。

§opacity: u8

容器与子树整体不透明度(0..=255,默认 255)。

§active_bg: Option<Color>

按下态(Active)背景色覆盖。

§hover_bg: Option<Color>

悬停态(Hover)背景色覆盖。

§bg_grad: Option<(Color, bool)>

线性渐变终点颜色与方向 (to_color, is_horizontal)。

§focus_border: Option<(u8, Color)>

键盘/旋钮聚焦态(Focus)边框 (width, color) 覆盖。

§focusable: bool

是否可纳入物理按键/编码器 Tab/Up/Down 焦点链。

§is_overlay: bool

是否将该子树提升至顶层 Z-Order 延迟渲染队列(用于 Modal / Dropdown / Tooltip 越过父裁剪框)。

§occlude_hit: bool

是否拦截并吞噬落在该容器内的指针命中事件(防止点击穿透 Modal 遮罩层)。

§auto_repeat: bool

按住不放时是否自动连发 on_click(用于 +/- 连续调节按钮)。

§scrollable_max: Option<i16>

可触摸拖拽滚动的最大垂直偏移量(Some(max_px) 表示启用触摸惯性滚动容器)。

§pos: Option<(i16, i16)>

可选的相对于父容器内容区左上角的叠层偏移坐标 (x, y)(用于表盘/徽标/浮层叠放)。

§first_child: Option<&'a ElementNode<'a>>

第一个子节点引用(侵入式单向链表头)。

§last_child: Option<&'a ElementNode<'a>>

最后一个子节点引用(用于 $O(1)$ 安全尾插,消除裸指针 UB)。

§on_click: Option<&'a dyn Fn(&mut ActionScope<'_>)>

点击事件响应闭包(分配于 ScratchArena)。

§on_long_press: Option<&'a dyn Fn(&mut ActionScope<'_>)>

长按事件响应闭包(按住超过 500ms 触发,分配于 ScratchArena)。

§on_drag: Option<&'a dyn Fn(&mut ActionScope<'_>)>

拖拽事件响应闭包(分配于 ScratchArena)。

§on_hover: Option<&'a dyn Fn(bool, &mut ActionScope<'_>)>

指针悬停进入/离开状态变更回调闭包(true 进入,false 离开;分配于 ScratchArena)。

§on_pointer_move: Option<&'a dyn Fn(&mut ActionScope<'_>)>

指针在热区内移动时的连续追踪回调闭包(未按下悬停移动时触发,坐标由 ActionScope::drag_event() 读取)。

§on_swipe: Option<&'a dyn Fn(SwipeDir, &mut ActionScope<'_>)>

四向快速滑动手势回调闭包(分配于 ScratchArena)。

§on_key_input: Option<&'a dyn Fn(KeyCode, &mut ActionScope<'_>)>

字符与文本输入事件响应闭包(分配于 ScratchArena,供聚焦态 TextInput 编辑使用)。

§on_key_nav: Option<&'a dyn Fn(KeyCode, &mut ActionScope<'_>)>

控件局部导航键(方向键、Home/End、Enter/Space)响应闭包(不抢占 Tab/BackTab 焦点切换,亦不触发文本 IME)。

§on_navigate_back: Option<&'a dyn Fn(&mut ActionScope<'_>)>

系统返回导航请求回调闭包(Android Back / 浏览器后退 / 左边缘返回手势 / 桌面 Escape 关闭浮层)。

§on_secondary_click: Option<&'a dyn Fn(&mut ActionScope<'_>)>

鼠标右键(次键)点击回调闭包(分配于 ScratchArena)。

§z_index: i8

显式層级排序优先级(默认 0;用于控制同层或浮层间的绘制先后顺序)。

§shadow: Option<(u8, i8, i8, Color)>

解析式 SDF 软阴影 (blur_radius, offset_x, offset_y, color)(无需离屏模糊缓冲区)。

§grid_cols: u8

二维网格布局列数(0 表示常规 Flexbox,>= 1 表示按指定列数自动排列的二维 Grid)。

§transition: Option<TransitionSpec>

声明式过渡动画配置。

§clip_children: bool

是否裁剪超出容器边界的子节点(如滚动列表视口)。

§align_self: Option<AlignItems>

子节点独立交叉轴对齐方式覆盖(align-self)。

§cursor: Option<CursorShape>

显式指定的鼠标光标形状(None 时按节点交互能力自动推断 Pointer / Text / Grab / Default)。

§text_color: Option<Color>

容器级可继承文本颜色(未显式设 .color(...) 的子 Text 自动继承)。

§text_size: Option<u8>

容器级可继承字号(未显式设 .size(...) 的子 Text 自动继承)。

§hover_style: Option<StyleRefinement>

悬停态样式覆写增量(由 .hover(|s| ...) 写入,支持背景/边框/文本色/不透明度/圆角)。

§active_style: Option<StyleRefinement>

按下态样式覆写增量(由 .active(|s| ...) 写入)。

§focus_style: Option<StyleRefinement>

聚焦态样式覆写增量(由 .focus(|s| ...) 写入)。

§items_baseline: bool

行容器内是否按子元素文本基线对齐(items-baseline)。

§effects: PaintEffects<'a>

高级视觉特效包(多色标渐变、四角独立圆角、混合模式、模糊/色彩滤镜、毛玻璃、2D 变换与路径裁剪;未设置时零分配)。

§external_texture: Option<ExternalTextureSpec>

外部零拷贝 GPU 纹理描述(仅在绑定时按需在帧内分配,对常规节点零内存开销)。

§layout_ext: LayoutExtras<'a>

高级布局扩展(aspect_ratio / Grid span & fr / sticky_top / RTL 镜像 / 滚动链,未设时零分配)。

Implementations§

Source§

impl<'a> Div<'a>

Source

pub fn id(self, id: u32) -> Self

设置元素的跨帧唯一标识符(用于过渡动画与滚动位置记忆)。

Source

pub fn scoped_id(self, cx: &FrameScope, local_id: u32) -> Self

基于当前 FrameScope 作用域 ID 栈派生全局唯一的元素标识符(避免复用组件时 ID 撞车)。

Source

pub fn pos(self, x: i16, y: i16) -> Self

设置相对于父容器内容区左上角的叠层偏移坐标 (x, y)(脱离常规线性流,用于叠层拼装)。

Source

pub fn safe_area(self, cx: &FrameScope) -> Self

自动叠加移动端/异形屏安全区域内边距(状态栏、刘海屏、底部 Home Indicator 与软键盘高度,支持 >127px 软键盘不截断)。

Source

pub fn pt_safe(self, cx: &FrameScope) -> Self

自动叠加顶部安全区域内边距(用于顶部导航栏 NavBar 避开刘海屏/状态栏)。

Source

pub fn pb_safe(self, cx: &FrameScope) -> Self

自动叠加底部安全区域与软键盘内边距(用于底部 TabBar 或 BottomSheet 避开 Home Indicator 与软键盘)。

Source

pub fn mx(self, px: i16) -> Self

设置水平外边距(左右)。

Source

pub fn my(self, px: i16) -> Self

设置垂直外边距(上下)。

Source

pub fn mt(self, px: i16) -> Self

设置上外边距。

Source

pub fn mb(self, px: i16) -> Self

设置下外边距。

Source

pub fn ml(self, px: i16) -> Self

设置左外边距。

Source

pub fn mr(self, px: i16) -> Self

设置右外边距。

Source

pub fn min_w(self, px: i16) -> Self

设置最小宽度像素约束。

Source

pub fn max_w(self, px: i16) -> Self

设置最大宽度像素约束。

Source

pub fn min_h(self, px: i16) -> Self

设置最小高度像素约束。

Source

pub fn max_h(self, px: i16) -> Self

设置最大高度像素约束。

Source

pub fn opacity(self, alpha: u8) -> Self

设置容器及其子树的整体不透明度(0..=255)。

Source

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

设置指针按下(Active)时的背景色。

Source

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

设置指针悬停(Hover)时的背景色。

Source

pub fn hover(self, f: impl FnOnce(StyleRefinement) -> StyleRefinement) -> Self

GPUI 风格悬停态样式闭包(如 .hover(|s| s.bg(rgb(0xf5f5f5)).border_color(rgb(0x171717))))。

若闭包仅覆写背景色,自动退化为零分配 hover_bg 快速路径;否则完整保留边框、文本色、不透明度与圆角覆写。

Source

pub fn active(self, f: impl FnOnce(StyleRefinement) -> StyleRefinement) -> Self

GPUI 风格按下态(Active)样式闭包(如 .active(|s| s.bg(rgb(0xe5e5e5))))。

Source

pub fn focus(self, f: impl FnOnce(StyleRefinement) -> StyleRefinement) -> Self

GPUI 风格聚焦态(Focus)样式闭包(如 .focus(|s| s.border_1().border_color(rgb(0x3b82f6)))),自动开启 focusable。

Source

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

设置容器级可继承文本颜色(子树中未显式调用 .color(...) 的 text(...) 自动继承)。

Source

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

设置容器级可继承字号像素(子树中未显式调用 .size(...) 的 text(...) 自动继承)。

Source

pub fn text_xs(self) -> Self

容器级可继承字号 Tailwind 简写(11px / 12px / 14px / 16px / 18px / 22px / 28px)。

Source

pub fn text_sm(self) -> Self

Source

pub fn text_base(self) -> Self

Source

pub fn text_lg(self) -> Self

Source

pub fn text_xl(self) -> Self

Source

pub fn text_2xl(self) -> Self

Source

pub fn text_3xl(self) -> Self

Source

pub fn opacity_f(self, alpha: f32) -> Self

浮点不透明度简写(0.0..=1.0,映射到 0..=255)。

Source

pub fn mx_0(self) -> Self

Source

pub fn mx_1(self) -> Self

Source

pub fn mx_2(self) -> Self

Source

pub fn mx_3(self) -> Self

Source

pub fn mx_4(self) -> Self

Source

pub fn my_0(self) -> Self

Source

pub fn my_1(self) -> Self

Source

pub fn my_2(self) -> Self

Source

pub fn my_3(self) -> Self

Source

pub fn my_4(self) -> Self

Source

pub fn mt_1(self) -> Self

Source

pub fn mt_2(self) -> Self

Source

pub fn mt_3(self) -> Self

Source

pub fn mt_4(self) -> Self

Source

pub fn mb_1(self) -> Self

Source

pub fn mb_2(self) -> Self

Source

pub fn mb_3(self) -> Self

Source

pub fn mb_4(self) -> Self

Source

pub fn ml_1(self) -> Self

Source

pub fn ml_2(self) -> Self

Source

pub fn ml_3(self) -> Self

Source

pub fn ml_4(self) -> Self

Source

pub fn mr_1(self) -> Self

Source

pub fn mr_2(self) -> Self

Source

pub fn mr_3(self) -> Self

Source

pub fn mr_4(self) -> Self

Source

pub fn relative(self) -> Self

语义化定位标记(Velox 子节点 .pos(x, y) 天然相对父容器左上角定位)。

Source

pub fn block(self) -> Self

块级垂直容器简写(等价 .flex_col())。

Source

pub fn inline_flex(self) -> Self

行内弹性容器简写(等价 .flex_row())。

Source

pub fn cursor_pointer(self) -> Self

Source

pub fn cursor_default(self) -> Self

Source

pub fn cursor_text(self) -> Self

Source

pub fn cursor_not_allowed(self) -> Self

Source

pub fn cursor_grab(self) -> Self

Source

pub fn cursor_grabbing(self) -> Self

Source

pub fn shadow_none(self) -> Self

Source

pub fn shadow_sm(self) -> Self

Source

pub fn shadow_md(self) -> Self

Source

pub fn shadow_lg(self) -> Self

Source

pub fn shadow_xl(self) -> Self

Source

pub fn bg_gradient(self, to_color: Color) -> Self

设置自顶向下的垂直线性渐变终点颜色(起点颜色为 .bg(...))。

Source

pub fn bg_gradient_x(self, to_color: Color) -> Self

设置自左向右的水平线性渐变终点颜色(起点颜色为 .bg(...))。

Source

pub fn overlay(self) -> Self

将当前节点及子树提升至顶层 Z-Order 渲染队列(脱离父级裁剪并覆盖在普通层之上,用于 Modal / Dropdown)。

Source

pub fn occlude_hit(self) -> Self

拦截并吞噬落在该容器区域内的指针命中事件,阻断点击穿透至底层控件(如 Modal 遮罩层)。

Source

pub fn auto_repeat(self) -> Self

开启按住不放自动连发(按住超过 400ms 后每 100ms 自动触发一次 on_click)。

Source

pub fn on_long_press_raw( self, handler: &'a dyn Fn(&mut ActionScope<'_>), ) -> Self

绑定原始长按回调闭包(按住 >= 500ms 触发)。

Source

pub fn on_long_press( self, cx: &'a FrameScope, handler: &'a dyn Fn(ClickEvent, &mut ActionScope<'_>), ) -> Self

绑定与 cx.listener(...) 兼容的长按回调闭包(按住 >= 500ms 触发)。

Source

pub fn focus_border(self, width: u8, color: Color) -> Self

设置物理按键/旋钮焦点命中时的边框高亮样式,并自动开启 focusable。

Source

pub fn no_focus_border(self) -> Self

显式禁止在聚焦态绘制外围焦点边框(适用于 Slider、透明容器、内嵌滚动视口及 .unstyled() 控件)。

Source

pub fn cursor(self, cursor: CursorShape) -> Self

显式指定鼠标悬停在此节点时的光标形状(如 CursorShape::Pointer / Grab / Text / NotAllowed / ResizeEW)。

Source

pub fn focusable(self) -> Self

显式将该节点加入物理按键/旋钮焦点导航链。

Source

pub fn unfocusable(self) -> Self

显式禁止该节点抢占键盘焦点(适用于右键上下文菜单项、清空按钮与点击外部关闭遮罩,点击后保持底层输入框焦点不丢失)。

Source

pub fn scrollable(self, max_scroll: i16) -> Self

将当前容器标记为可触摸拖拽/滚轮滚动的视口,并指定最大可滚动偏移量 max_scroll(自动开启 overflow_hidden)。

Source

pub fn scrollable_auto(self) -> Self

将当前容器标记为按内容实际尺寸自动测量最大滚动范围的视口(自动开启 overflow_hidden,同时支持垂直与水平滚动)。

Source

pub fn align_self(self, align: AlignItems) -> Self

独立覆盖当前节点在父容器交叉轴上的对齐方式(align-self)。

Source

pub fn self_start(self) -> Self

交叉轴自身起始对齐(self-start)。

Source

pub fn self_center(self) -> Self

交叉轴自身居中对齐(self-center)。

Source

pub fn self_end(self) -> Self

交叉轴自身末尾对齐(self-end)。

Source

pub fn self_stretch(self) -> Self

交叉轴自身拉伸对齐(self-stretch)。

Source

pub fn items_baseline(self) -> Self

在水平行容器(flex_row)中启用子元素按文本基线对齐(items-baseline)。

Source

pub fn overflow_hidden(self) -> Self

启用裁剪子元素(等价 CSS overflow: hidden)。

Source

pub fn overflow_visible(self) -> Self

关闭子元素裁剪(等价 CSS overflow: visible)。

Source

pub fn overflow_scroll(self) -> Self

启用自动测量边界的滚动视口(等价 CSS overflow: auto/scroll)。

Source

pub fn overflow_y_scroll(self) -> Self

启用垂直方向自动测量滚动视口(等价 CSS overflow-y: auto/scroll)。

Source

pub fn overflow_x_scroll(self) -> Self

启用水平方向自动测量滚动视口(等价 CSS overflow-x: auto/scroll)。

Source

pub fn transition(self) -> Self

Tailwind / GPUI 风格默认过渡动画(150ms 颜色 + 不透明度 + 几何边界,EaseOut)。

Source

pub fn transition_colors(self) -> Self

Tailwind / GPUI 风格颜色过渡简写(150ms 背景/边框/文本颜色平滑过渡)。

Source

pub fn transition_opacity(self) -> Self

Tailwind / GPUI 风格不透明度过渡简写(150ms 淡入淡出)。

Source

pub fn transition_all(self) -> Self

Tailwind / GPUI 风格全属性过渡简写(150ms 颜色 + 边界 + 不透明度)。

Source

pub fn transition_none(self) -> Self

显式禁用该节点上的过渡动画(等价 CSS transition: none)。

Source

pub fn duration_75(self) -> Self

Source

pub fn duration_100(self) -> Self

Source

pub fn duration_150(self) -> Self

Source

pub fn duration_200(self) -> Self

Source

pub fn duration_300(self) -> Self

Source

pub fn duration_500(self) -> Self

Source

pub fn ease_linear(self) -> Self

Source

pub fn ease_in(self) -> Self

Source

pub fn ease_out(self) -> Self

Source

pub fn ease_in_out(self) -> Self

Source

pub fn ease_spring(self) -> Self

Source

pub fn animate_color(self, duration: Duration) -> Self

声明背景色与边框/子文本颜色的跨帧平滑过渡动画。

Source

pub fn animate_bg(self, duration: Duration) -> Self

声明背景色的跨帧平滑过渡动画。

Source

pub fn animate_bounds(self, duration: Duration) -> Self

声明几何边界框(位置/尺寸)的跨帧平滑过渡动画。

Source

pub fn ease(self, easing: Easing) -> Self

设置过渡动画的缓动曲线(Linear / EaseIn / EaseOut / EaseInOut / Spring)。

Source

pub fn repeat_infinite(self) -> Self

设置动画为无限循环模式。

Source

pub fn repeat_ping_pong(self) -> Self

设置动画为无限往复(0 -> 1 -> 0)循环模式。

Source

pub fn duration(self, duration: Duration) -> Self

修改当前过渡动画的时长(不改变已声明的插值属性)。

Source

pub fn delay(self, delay: Duration) -> Self

设置过渡/入场动画开始前的延迟(用于列表项交错 stagger 入场等编排)。

Source

pub fn animate_opacity(self, duration: Duration) -> Self

声明容器整体不透明度(.opacity(...))的跨帧淡入淡出过渡,作用于整个子树。

Source

pub fn animate_all(self, duration: Duration) -> Self

同时声明颜色、几何边界与不透明度的跨帧过渡(等价 CSS transition: all)。

Source

pub fn enter_from( self, opacity: u8, dx: i16, dy: i16, duration: Duration, ) -> Self

声明首次出现时的入场动画:从不透明度 opacity 与偏移 (dx, dy) 平滑过渡到布局目标状态。

Source

pub fn fade_in(self, duration: Duration) -> Self

首次出现时从完全透明淡入(入场动画快捷方式)。

Source

pub fn slide_in(self, dx: i16, dy: i16, duration: Duration) -> Self

首次出现时从偏移 (dx, dy) 处滑入并同时淡入(入场动画快捷方式)。

Source

pub fn ping_pong_bg(self, from_bg: Color, duration: Duration) -> Self

声明在 from_bg 与当前 .bg(...) 之间无限往复呼吸的循环动画(如呼吸指示灯)。

Source

pub fn on_click_raw(self, handler: &'a dyn Fn(&mut ActionScope<'_>)) -> Self

绑定原始点击回调闭包。

Source

pub fn on_click( self, cx: &'a FrameScope, handler: &'a dyn Fn(ClickEvent, &mut ActionScope<'_>), ) -> Self

绑定与 cx.listener(...) 兼容的点击回调闭包。

Source

pub fn on_secondary_click_raw( self, handler: &'a dyn Fn(&mut ActionScope<'_>), ) -> Self

绑定原始鼠标右键(次键)点击回调闭包。

Source

pub fn on_secondary_click( self, cx: &'a FrameScope, handler: &'a dyn Fn(ClickEvent, &mut ActionScope<'_>), ) -> Self

绑定与 cx.listener(...) 兼容的鼠标右键(次键)点击回调闭包。

Source

pub fn on_drag_raw(self, handler: &'a dyn Fn(&mut ActionScope<'_>)) -> Self

绑定原始拖拽回调闭包。

Source

pub fn on_drag( self, cx: &'a FrameScope, handler: &'a dyn Fn(DragEvent, &mut ActionScope<'_>), ) -> Self

绑定与 cx.listener(...) 兼容的触摸/鼠标拖拽回调闭包(如 Slider 连续滑动)。

Source

pub fn on_hover_raw( self, handler: &'a dyn Fn(bool, &mut ActionScope<'_>), ) -> Self

绑定原始指针悬停进入/离开回调闭包(true 进入,false 离开)。

Source

pub fn on_hover( self, _cx: &'a FrameScope, handler: &'a dyn Fn(bool, &mut ActionScope<'_>), ) -> Self

绑定与 cx.listener(...) 兼容的指针悬停进入/离开回调闭包(bool 为 true 表示进入、false 表示离开)。

Source

pub fn on_pointer_move_raw( self, handler: &'a dyn Fn(&mut ActionScope<'_>), ) -> Self

绑定原始指针热区内移动追踪回调闭包(未按下悬停移动时触发)。

Source

pub fn on_pointer_move( self, cx: &'a FrameScope, handler: &'a dyn Fn(DragEvent, &mut ActionScope<'_>), ) -> Self

绑定与 cx.listener(...) 兼容的指针热区内移动追踪回调闭包(传入含局部坐标的 DragEvent,适用于图表实时悬停追踪)。

Source

pub fn on_swipe( self, _cx: &'a FrameScope, handler: &'a dyn Fn(SwipeDir, &mut ActionScope<'_>), ) -> Self

绑定与 cx.listener(...) 兼容的四向快速滑动手势(SwipeDir)回调闭包。

Source

pub fn key(self, key: impl AsRef<[u8]>) -> Self

设置列表项或动态节点的稳定键值(自动哈希为 u32 元素 ID,消除手动管理魔法数字冲突)。

Source

pub fn z_index(self, z: i8) -> Self

设置元素的 Z-Index 层级(用于在同父容器兄弟节点间调整前后绘制顺序;若需脱离父容器裁剪并提升至全屏最顶层,请显式调用 .overlay())。

Source

pub fn on_key_input( self, handler: &'a dyn Fn(KeyCode, &mut ActionScope<'_>), ) -> Self

绑定键盘字符/编辑键回调闭包(用于聚焦态 TextInput 接收 Char(c)、Backspace、Delete、Left/Right 等)。

Source

pub fn on_key_nav( self, handler: &'a dyn Fn(KeyCode, &mut ActionScope<'_>), ) -> Self

绑定非文本控件的局部键盘导航回调闭包(供 Slider / Tabs / RadioGroup / Select 在聚焦或浮层打开时响应方向键、Home/End、Enter/Space,绝不吞掉 Tab/BackTab 焦点切换)。

Source

pub fn on_navigate_back(self, handler: &'a dyn Fn(&mut ActionScope<'_>)) -> Self

绑定系统级返回请求(Android Back / 浏览器后退 / 左边缘返回手势)回调闭包。

Source

pub fn shadow(self, blur: u8, offset_x: i8, offset_y: i8, color: Color) -> Self

设置解析式 SDF 外阴影(blur: 模糊扩散半径 1..=64px,offset_x/offset_y: 阴影偏移,color: 阴影颜色)。

Source

pub fn grid(self, cols: u8) -> Self

将当前容器启用为指定列数 cols 的二维网格布局。

Source

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

链式追加单个子节点(通过 ScratchArena + Cell 侵入式链表连接,$O(1)$ 耗时,100% 遵循 Stacked Borrows 安全规范)。

Source

pub fn child_opt( self, cx: &'a FrameScope, child: Option<impl IntoElement<'a>>, ) -> Self

可选子节点追加(当 child 为 Some(c) 时追加,否则无操作)。

Source

pub fn children<I, E>(self, cx: &'a FrameScope, iter: I) -> Self
where I: IntoIterator<Item = E>, E: IntoElement<'a>,

批量追加任意迭代器生成的子节点序列。

Source

pub fn justify_start_localized(self, cx: &FrameScope) -> Self

按当前语言的书写方向设置主轴“逻辑起始端对齐”(LTR 为 Start,RTL 自动镜像为 End)。

Source

pub fn justify_end_localized(self, cx: &FrameScope) -> Self

按当前语言的书写方向设置主轴“逻辑末端对齐”(LTR 为 End,RTL 自动镜像为 Start)。

Source

pub fn ps(self, cx: &FrameScope, px: i8) -> Self

按当前语言方向设置逻辑起始端内边距(CSS padding-inline-start:LTR 为 pl,RTL 自动镜像为 pr)。

Source

pub fn pe(self, cx: &FrameScope, px: i8) -> Self

按当前语言方向设置逻辑末端内边距(CSS padding-inline-end:LTR 为 pr,RTL 自动镜像为 pl)。

Source

pub fn ms(self, cx: &FrameScope, px: i16) -> Self

按当前语言方向设置逻辑起始端外边距(CSS margin-inline-start:LTR 为 ml,RTL 自动镜像为 mr)。

Source

pub fn me(self, cx: &FrameScope, px: i16) -> Self

按当前语言方向设置逻辑末端外边距(CSS margin-inline-end:LTR 为 mr,RTL 自动镜像为 ml)。

Source

pub fn rounded_corners(self, radii: CornerRadii) -> Self

设置四角独立圆角 [tl, tr, br, bl]。

Source

pub fn rounded_t(self, r: u8) -> Self

仅设置顶部两角圆角(底部直角)。

Source

pub fn rounded_b(self, r: u8) -> Self

仅设置底部两角圆角(顶部直角)。

Source

pub fn rounded_l(self, r: u8) -> Self

仅设置左侧两角圆角(右侧直角)。

Source

pub fn rounded_r(self, r: u8) -> Self

仅设置右侧两角圆角(左侧直角)。

Source

pub fn bg_paint(self, paint: Paint<'a>) -> Self

设置任意完整填充画刷 Paint(多色标 Linear / Radial / Conic 渐变或纯色)。

Source

pub fn bg_linear_gradient( self, cx: &'a FrameScope, angle_deg: f32, stops: &[ColorStop], ) -> Self

设置多色标任意角度线性渐变(色标切片自动拷贝进帧级 ScratchArena,零堆分配)。

Source

pub fn bg_radial_gradient(self, cx: &'a FrameScope, stops: &[ColorStop]) -> Self

设置多色标居中径向渐变。

Source

pub fn bg_radial_focal_gradient( self, cx: &'a FrameScope, center: [f32; 2], radius: f32, focal: [f32; 2], focal_radius: f32, stops: &[ColorStop], ) -> Self

设置多色标双圆焦点径向渐变。

Source

pub fn bg_conic_gradient( self, cx: &'a FrameScope, start_angle_deg: f32, stops: &[ColorStop], ) -> Self

设置多色标锥形/扫描渐变(start_angle_deg 以 12 点钟方向为 0° 顺时针)。

Source

pub fn bg_gradient_extend(self, mode: ExtendMode) -> Self

修改已配置的背景渐变延展模式(Pad / Repeat / Reflect)。

Source

pub fn bg_gradient_space(self, space: GradientSpace) -> Self

修改已配置的背景渐变插值色彩空间(Srgb / LinearRgb / Oklab)。

Source

pub fn blend_mode(self, mode: BlendMode) -> Self

设置图元/图层合成与混合模式(完整 27 种 Porter-Duff + W3C 混合模式)。

Source

pub fn isolate(self) -> Self

显式开启隔离合成图层(使 .opacity(...) 作为真正的 Group Opacity 合成,重叠子元素互不透底)。

Source

pub fn filter(self, filter: LayerFilter) -> Self

设置完整图层后处理滤镜 LayerFilter。

Source

pub fn blur(self, radius: u8) -> Self

设置子树高斯/Kawase 模糊半径(逻辑像素)。

Source

pub fn color_matrix(self, matrix: ColorMatrix) -> Self

叠加 4×5 色彩矩阵滤镜(可多次链式调用,自动矩阵右乘复合)。

Source

pub fn grayscale(self, amount: f32) -> Self

灰度滤镜(amount ∈ [0.0, 1.0])。

Source

pub fn sepia(self, amount: f32) -> Self

怀旧棕褐滤镜(amount ∈ [0.0, 1.0])。

Source

pub fn saturate(self, amount: f32) -> Self

饱和度滤镜(1.0 不变,0.0 灰度,> 1.0 增艳)。

Source

pub fn brightness(self, amount: f32) -> Self

亮度滤镜(1.0 不变)。

Source

pub fn contrast(self, amount: f32) -> Self

对比度滤镜(1.0 不变)。

Source

pub fn hue_rotate(self, deg: f32) -> Self

色相旋转滤镜(角度制 deg)。

Source

pub fn invert(self, amount: f32) -> Self

反色滤镜(amount ∈ [0.0, 1.0])。

Source

pub fn drop_shadow( self, blur: u8, offset_x: i8, offset_y: i8, color: Color, ) -> Self

任意子树轮廓投影滤镜(CSS filter: drop-shadow(...))。

Source

pub fn backdrop_filter(self, filter: BackdropFilter) -> Self

设置完整实时背景滤镜 BackdropFilter。

Source

pub fn backdrop_blur(self, radius: u8) -> Self

开启实时背景毛玻璃模糊(CSS backdrop-filter: blur(...))。

Source

pub fn backdrop_acrylic(self, blur_radius: u8, tint: Color) -> Self

一键开启现代 Acrylic / Vibrancy 毛玻璃材质(背景模糊 + 饱和度提亮 + 微颗粒 + 磨砂着色)。

Source

pub fn transform(self, t: Transform2D) -> Self

叠加 2D 仿射变换(以容器自身中心为原点;支持多次链式复合)。

Source

pub fn rotate_deg(self, deg: f32) -> Self

绕元素中心顺时针旋转(角度制 deg)。

Source

pub fn scale(self, sx: f32, sy: f32) -> Self

绕元素中心缩放 (sx, sy)。

Source

pub fn translate(self, tx: f32, ty: f32) -> Self

沿 (tx, ty) 平移视觉位置(不触发布局重排)。

Source

pub fn skew(self, ax_deg: f32, ay_deg: f32) -> Self

错切变换(角度制 ax, ay)。

Source

pub fn clip_path(self, path_d: &'static str) -> Self

使用任意静态 SVG Path 字符串(d="...")对容器及子树执行抗锯齿矢量裁剪。

Source

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

使用帧内动态 SVG Path 字符串对容器及子树执行抗锯齿矢量裁剪。

Source

pub fn external_texture(self, id: ExternalTextureId) -> Self

绑定外部零拷贝 GPU 纹理槽位(如海图/雷达/视频/3D 引擎共享的 wgpu::TextureView)。

  • 硬件 wgpu 后端直接零拷贝采样该纹理并支持四角圆角、混合与上方实时毛玻璃联动;
  • 软件光栅或无 GPU 模式下自动降级为 fallback_bg 圆角占位。
Source

pub fn external_texture_spec(self, spec: ExternalTextureSpec) -> Self

绑定完整配置的外部零拷贝纹理描述 ExternalTextureSpec。

Source

pub fn external_texture_uv(self, uv_rect: [f32; 4]) -> Self

配置外部纹理的归一化采样 UV 矩形 [u0, v0, u1, v1]。

Source

pub fn external_texture_revision(self, revision: u64) -> Self

更新外部纹理内容版本号(外部引擎重绘同一纹理时递增此值,精准驱动脏区刷新)。

Source

pub fn external_texture_format( self, premultiplied: bool, fallback_bg: Color, ) -> Self

配置外部纹理的 Alpha 预乘约定与软件降级占位色。

Source

pub fn aspect_ratio(self, ratio: f32) -> Self

设置容器纵横比约束 width / height(例如 16.0 / 9.0 对应 16:9 视频卡片,高度为 Auto 时自动由宽度推算)。

Source

pub fn grid_col_span(self, span: u8) -> Self

设置 CSS Grid 子项跨列数(如 .grid_col_span(2) 横跨两列)。

Source

pub fn grid_template_fr(self, cx: &'a FrameScope, weights: &[u16]) -> Self

设置 CSS Grid 自定义列权重(例如 .grid_template_fr(cx, &[1, 2, 1]) 对应 1fr 2fr 1fr,同步设定 grid_cols)。

Source

pub fn sticky_top(self, offset: i16) -> Self

启用 position: sticky 吸顶定位(当所属滚动容器向下滚动时,将节点吸附固定在视口顶部偏移 offset 处)。

Source

pub fn rtl(self, rtl: bool) -> Self

显式开启或关闭 RTL(右至左)行布局镜像(FlexDir::Row 自动从右向左排布子节点)。

Source

pub fn rtl_auto(self, cx: &FrameScope) -> Self

根据当前 FrameScope 的语言方向自动开启 RTL 行布局镜像。

Source

pub fn overflow_auto(self) -> Self

开启 overflow: auto 自动内容测算滚动模式(自动根据子元素总高度/总宽度计算 max_scroll,无需手传上限)。

Source

pub fn scroll_chaining(self, enable: bool) -> Self

配置嵌套滚动链开关(内层滚动容器触顶/触底后是否继续向上冒泡给外层滚动容器,默认 true)。

Trait Implementations§

Source§

impl<'a> IntoElement<'a> for Div<'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>)。
Source§

impl<'a> Styled for Div<'a>

Source§

fn style_mut(&mut self) -> &mut Style

获取内部 Style 的可变引用。
Source§

fn flex(self) -> Self

开启弹性布局(等价 CSS display: flex,默认水平主轴 Row)。
Source§

fn flex_row(self) -> Self

Source§

fn flex_col(self) -> Self

Source§

fn flex_wrap(self) -> Self

Source§

fn flex_nowrap(self) -> Self

Source§

fn flex_1(self) -> Self

Source§

fn flex_none(self) -> Self

Source§

fn size_full(self) -> Self

Source§

fn size(self, px: i16) -> Self

同时设置等宽高正方形尺寸(像素)。
Source§

fn w_full(self) -> Self

Source§

fn h_full(self) -> Self

Source§

fn w_auto(self) -> Self

Source§

fn h_auto(self) -> Self

Source§

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

Source§

fn h(self, px: i16) -> Self

Source§

fn w_pct(self, pct: i16) -> Self

设置宽度占父容器可用宽度的百分比(0..=100)。
Source§

fn h_pct(self, pct: i16) -> Self

设置高度占父容器可用高度的百分比(0..=100)。
Source§

fn w_1_2(self) -> Self

Source§

fn w_1_3(self) -> Self

Source§

fn w_2_3(self) -> Self

Source§

fn w_1_4(self) -> Self

Source§

fn w_3_4(self) -> Self

Source§

fn h_1_2(self) -> Self

Source§

fn size_0(self) -> Self

Source§

fn size_0_5(self) -> Self

Source§

fn size_1(self) -> Self

Source§

fn size_1_5(self) -> Self

Source§

fn size_2(self) -> Self

Source§

fn size_2_5(self) -> Self

Source§

fn size_3(self) -> Self

Source§

fn size_3_5(self) -> Self

Source§

fn size_4(self) -> Self

Source§

fn size_5(self) -> Self

Source§

fn size_6(self) -> Self

Source§

fn size_7(self) -> Self

Source§

fn size_8(self) -> Self

Source§

fn size_9(self) -> Self

Source§

fn size_10(self) -> Self

Source§

fn size_11(self) -> Self

Source§

fn size_12(self) -> Self

Source§

fn size_14(self) -> Self

Source§

fn size_16(self) -> Self

Source§

fn size_20(self) -> Self

Source§

fn size_24(self) -> Self

Source§

fn size_32(self) -> Self

Source§

fn w_0(self) -> Self

Source§

fn w_0_5(self) -> Self

Source§

fn w_1(self) -> Self

Source§

fn w_1_5(self) -> Self

Source§

fn w_2(self) -> Self

Source§

fn w_2_5(self) -> Self

Source§

fn w_3(self) -> Self

Source§

fn w_3_5(self) -> Self

Source§

fn w_4(self) -> Self

Source§

fn w_5(self) -> Self

Source§

fn w_6(self) -> Self

Source§

fn w_7(self) -> Self

Source§

fn w_8(self) -> Self

Source§

fn w_9(self) -> Self

Source§

fn w_10(self) -> Self

Source§

fn w_11(self) -> Self

Source§

fn w_12(self) -> Self

Source§

fn w_14(self) -> Self

Source§

fn w_16(self) -> Self

Source§

fn w_20(self) -> Self

Source§

fn w_24(self) -> Self

Source§

fn w_28(self) -> Self

Source§

fn w_32(self) -> Self

Source§

fn w_36(self) -> Self

Source§

fn w_40(self) -> Self

Source§

fn w_44(self) -> Self

Source§

fn w_48(self) -> Self

Source§

fn w_52(self) -> Self

Source§

fn w_56(self) -> Self

Source§

fn w_60(self) -> Self

Source§

fn w_64(self) -> Self

Source§

fn w_72(self) -> Self

Source§

fn w_80(self) -> Self

Source§

fn w_96(self) -> Self

Source§

fn h_0(self) -> Self

Source§

fn h_0_5(self) -> Self

Source§

fn h_1(self) -> Self

Source§

fn h_1_5(self) -> Self

Source§

fn h_2(self) -> Self

Source§

fn h_2_5(self) -> Self

Source§

fn h_3(self) -> Self

Source§

fn h_3_5(self) -> Self

Source§

fn h_4(self) -> Self

Source§

fn h_5(self) -> Self

Source§

fn h_6(self) -> Self

Source§

fn h_7(self) -> Self

Source§

fn h_8(self) -> Self

Source§

fn h_9(self) -> Self

Source§

fn h_10(self) -> Self

Source§

fn h_11(self) -> Self

Source§

fn h_12(self) -> Self

Source§

fn h_14(self) -> Self

Source§

fn h_16(self) -> Self

Source§

fn h_20(self) -> Self

Source§

fn h_24(self) -> Self

Source§

fn h_32(self) -> Self

Source§

fn h_40(self) -> Self

Source§

fn h_48(self) -> Self

Source§

fn h_56(self) -> Self

Source§

fn h_64(self) -> Self

Source§

fn p(self, px: i8) -> Self

Source§

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

Source§

fn py(self, px: i8) -> Self

Source§

fn pt(self, px: i8) -> Self

Source§

fn pb(self, px: i8) -> Self

Source§

fn pl(self, px: i8) -> Self

Source§

fn pr(self, px: i8) -> Self

Source§

fn p_0(self) -> Self

Source§

fn p_0p5(self) -> Self

Source§

fn p_0_5(self) -> Self

Source§

fn p_1(self) -> Self

Source§

fn p_1p5(self) -> Self

Source§

fn p_1_5(self) -> Self

Source§

fn p_2(self) -> Self

Source§

fn p_2p5(self) -> Self

Source§

fn p_2_5(self) -> Self

Source§

fn p_3(self) -> Self

Source§

fn p_3p5(self) -> Self

Source§

fn p_3_5(self) -> Self

Source§

fn p_4(self) -> Self

Source§

fn p_5(self) -> Self

Source§

fn p_6(self) -> Self

Source§

fn p_8(self) -> Self

Source§

fn p_10(self) -> Self

Source§

fn p_12(self) -> Self

Source§

fn px_0(self) -> Self

Source§

fn px_0p5(self) -> Self

Source§

fn px_0_5(self) -> Self

Source§

fn px_1(self) -> Self

Source§

fn px_1p5(self) -> Self

Source§

fn px_1_5(self) -> Self

Source§

fn px_2(self) -> Self

Source§

fn px_2p5(self) -> Self

Source§

fn px_2_5(self) -> Self

Source§

fn px_3(self) -> Self

Source§

fn px_3p5(self) -> Self

Source§

fn px_3_5(self) -> Self

Source§

fn px_4(self) -> Self

Source§

fn px_5(self) -> Self

Source§

fn px_6(self) -> Self

Source§

fn px_8(self) -> Self

Source§

fn py_0(self) -> Self

Source§

fn py_0p5(self) -> Self

Source§

fn py_0_5(self) -> Self

Source§

fn py_1(self) -> Self

Source§

fn py_1p5(self) -> Self

Source§

fn py_1_5(self) -> Self

Source§

fn py_2(self) -> Self

Source§

fn py_2p5(self) -> Self

Source§

fn py_2_5(self) -> Self

Source§

fn py_3(self) -> Self

Source§

fn py_3p5(self) -> Self

Source§

fn py_3_5(self) -> Self

Source§

fn py_4(self) -> Self

Source§

fn py_5(self) -> Self

Source§

fn py_6(self) -> Self

Source§

fn py_8(self) -> Self

Source§

fn pt_0(self) -> Self

Source§

fn pt_1(self) -> Self

Source§

fn pt_2(self) -> Self

Source§

fn pt_3(self) -> Self

Source§

fn pt_4(self) -> Self

Source§

fn pb_0(self) -> Self

Source§

fn pb_1(self) -> Self

Source§

fn pb_2(self) -> Self

Source§

fn pb_3(self) -> Self

Source§

fn pb_4(self) -> Self

Source§

fn pl_0(self) -> Self

Source§

fn pl_1(self) -> Self

Source§

fn pl_2(self) -> Self

Source§

fn pl_3(self) -> Self

Source§

fn pl_4(self) -> Self

Source§

fn pr_0(self) -> Self

Source§

fn pr_1(self) -> Self

Source§

fn pr_2(self) -> Self

Source§

fn pr_3(self) -> Self

Source§

fn pr_4(self) -> Self

Source§

fn m(self, px: i8) -> Self

Source§

fn m_0(self) -> Self

Source§

fn m_0_5(self) -> Self

Source§

fn m_1(self) -> Self

Source§

fn m_1_5(self) -> Self

Source§

fn m_2(self) -> Self

Source§

fn m_2_5(self) -> Self

Source§

fn m_3(self) -> Self

Source§

fn m_4(self) -> Self

Source§

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

Source§

fn gap_0(self) -> Self

Source§

fn gap_0p5(self) -> Self

Source§

fn gap_0_5(self) -> Self

Source§

fn gap_1(self) -> Self

Source§

fn gap_1p5(self) -> Self

Source§

fn gap_1_5(self) -> Self

Source§

fn gap_2(self) -> Self

Source§

fn gap_2p5(self) -> Self

Source§

fn gap_2_5(self) -> Self

Source§

fn gap_3(self) -> Self

Source§

fn gap_3p5(self) -> Self

Source§

fn gap_3_5(self) -> Self

Source§

fn gap_4(self) -> Self

Source§

fn gap_5(self) -> Self

Source§

fn gap_6(self) -> Self

Source§

fn gap_8(self) -> Self

Source§

fn flex_grow(self, weight: u8) -> Self

Source§

fn items_center(self) -> Self

Source§

fn items_start(self) -> Self

Source§

fn items_end(self) -> Self

Source§

fn items_stretch(self) -> Self

Source§

fn justify_start(self) -> Self

Source§

fn justify_center(self) -> Self

Source§

fn justify_between(self) -> Self

Source§

fn justify_end(self) -> Self

Source§

fn justify_around(self) -> Self

Source§

fn bg(self, color: Color) -> Self

Source§

fn rounded(self, radius: u8) -> Self

Source§

fn rounded_none(self) -> Self

Source§

fn rounded_xs(self) -> Self

Source§

fn rounded_sm(self) -> Self

Source§

fn rounded_md(self) -> Self

Source§

fn rounded_lg(self) -> Self

Source§

fn rounded_xl(self) -> Self

Source§

fn rounded_2xl(self) -> Self

Source§

fn rounded_3xl(self) -> Self

Source§

fn rounded_full(self) -> Self

Source§

fn border(self, width: u8, color: Color) -> Self

Source§

fn border_0(self) -> Self

Source§

fn border_1(self) -> Self

Source§

fn border_2(self) -> Self

Source§

fn border_4(self) -> Self

Source§

fn border_8(self) -> Self

Source§

fn border_color(self, color: Color) -> Self

Source§

fn flex_shrink_0(self) -> Self

Auto Trait Implementations§

§

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

§

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

§

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

§

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

§

impl<'a> Forget for Div<'a>

§

impl<'a> Freeze for Div<'a>

§

impl<'a> Move for Div<'a>

§

impl<'a> Unpin for Div<'a>

§

impl<'a> UnsafeUnpin for Div<'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.