pub struct CodeBuilder { /* private fields */ }Expand description
Builder for a Code node: set the initial values, then
pass it to add.
Implementations§
Source§impl CodeBuilder
impl CodeBuilder
Sourcepub fn language(self, name: &str) -> Self
pub fn language(self, name: &str) -> Self
“rust”, “js”, “ts”, “python”, “json”, “toml”, “shell”; anything else is plain text.
Sourcepub fn line_height(self, v: f64) -> Self
pub fn line_height(self, v: f64) -> Self
Line height as a multiple of the font size.
Trait Implementations§
Source§impl Debug for CodeBuilder
impl Debug for CodeBuilder
Source§impl Default for CodeBuilder
impl Default for CodeBuilder
Source§impl NodeBuilder for CodeBuilder
impl NodeBuilder for CodeBuilder
Source§fn position(self, v: impl Into<Vec2>) -> Self
fn position(self, v: impl Into<Vec2>) -> Self
Sets
x and y together, e.g. .position((100.0, -50.0)).Source§fn line_width(self, v: f64) -> Self
fn line_width(self, v: f64) -> Self
Outline width in pixels. Default: 0 (no outline).
Source§fn start(self, v: f64) -> Self
fn start(self, v: f64) -> Self
Start of the drawn part of the outline, fraction of its length.
Source§fn end(self, v: f64) -> Self
fn end(self, v: f64) -> Self
End of the drawn part of the outline; animate 0 → 1 to draw it on.
Source§fn fill_gradient(self, g: Gradient) -> Self
fn fill_gradient(self, g: Gradient) -> Self
Gradient fill (local coordinates, origin at the node center);
overrides
fill.Source§fn stroke_gradient(self, g: Gradient) -> Self
fn stroke_gradient(self, g: Gradient) -> Self
Gradient outline; overrides
stroke.Source§fn dash(self, pattern: impl Into<Vec<f64>>) -> Self
fn dash(self, pattern: impl Into<Vec<f64>>) -> Self
Dash pattern: on, off, on, … lengths. Animate
dash_offset for
marching ants.Source§fn dash_offset(self, v: f64) -> Self
fn dash_offset(self, v: f64) -> Self
Shifts the dash pattern along the outline.
Source§fn blur(self, v: f64) -> Self
fn blur(self, v: f64) -> Self
Gaussian blur of the node and its children (standard deviation, in
the node’s units).
Source§fn shadow(self, color: Color, blur: f64, offset: impl Into<Vec2>) -> Self
fn shadow(self, color: Color, blur: f64, offset: impl Into<Vec2>) -> Self
Drop shadow under the node and its children.
Source§fn anchor(self, v: impl Into<Vec2>) -> Self
fn anchor(self, v: impl Into<Vec2>) -> Self
Pivot and placement point: (-1, -1) top-left … (1, 1) bottom-right.
Source§fn shrink(self, v: f64) -> Self
fn shrink(self, v: f64) -> Self
Inside a
Layout: how much this node gives up when space is short.Source§fn align_self(self, v: LayoutAlign) -> Self
fn align_self(self, v: LayoutAlign) -> Self
Inside a
Layout: overrides the layout’s cross-axis alignment.Source§fn child<C: NodeBuilder>(self, child: C) -> Self
fn child<C: NodeBuilder>(self, child: C) -> Self
Adds a child created together with this node. Use
Node::add when
you need the child’s handle.Auto Trait Implementations§
impl !RefUnwindSafe for CodeBuilder
impl !Send for CodeBuilder
impl !Sync for CodeBuilder
impl !UnwindSafe for CodeBuilder
impl Freeze for CodeBuilder
impl Unpin for CodeBuilder
impl UnsafeUnpin for CodeBuilder
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