Skip to main content

NodeKind

Enum NodeKind 

Source
pub enum NodeKind {
Show 23 variants Page { config: PageConfig, }, View, Text { content: String, href: Option<String>, runs: Vec<TextRun>, }, Image { src: String, width: Option<f64>, height: Option<f64>, }, Table { columns: Vec<ColumnDef>, }, TableRow { is_header: bool, }, TableCell { col_span: u32, row_span: u32, }, Fixed { position: FixedPosition, }, PageBreak, Svg { width: f64, height: f64, view_box: Option<String>, content: String, }, Canvas { width: f64, height: f64, operations: Vec<CanvasOp>, }, Barcode { data: String, format: BarcodeFormat, width: Option<f64>, height: f64, }, QrCode { data: String, size: Option<f64>, }, BarChart { data: Vec<ChartDataPoint>, width: f64, height: f64, color: Option<String>, show_labels: bool, show_values: bool, show_grid: bool, title: Option<String>, }, LineChart { series: Vec<ChartSeries>, labels: Vec<String>, width: f64, height: f64, show_points: bool, show_grid: bool, title: Option<String>, }, PieChart { data: Vec<ChartDataPoint>, width: f64, height: f64, donut: bool, show_legend: bool, title: Option<String>, }, AreaChart { series: Vec<ChartSeries>, labels: Vec<String>, width: f64, height: f64, show_grid: bool, title: Option<String>, }, DotPlot { groups: Vec<DotPlotGroup>, width: f64, height: f64, x_min: Option<f64>, x_max: Option<f64>, y_min: Option<f64>, y_max: Option<f64>, x_label: Option<String>, y_label: Option<String>, show_legend: bool, dot_size: f64, }, Watermark { text: String, font_size: f64, angle: f64, }, TextField { name: String, value: Option<String>, placeholder: Option<String>, width: f64, height: f64, multiline: bool, password: bool, read_only: bool, max_length: Option<u32>, font_size: f64, }, Checkbox { name: String, checked: bool, width: f64, height: f64, read_only: bool, }, Dropdown { name: String, options: Vec<String>, value: Option<String>, width: f64, height: f64, read_only: bool, font_size: f64, }, RadioButton { name: String, value: String, checked: bool, width: f64, height: f64, read_only: bool, },
}
Expand description

The different kinds of nodes in the document tree.

Variants§

§

Page

A page boundary. Content inside flows according to page config.

Fields

§config: PageConfig
§

View

A generic container, analogous to a

or React .

§

Text

A text node with string content.

Fields

§content: String
§href: Option<String>

Optional hyperlink URL.

§runs: Vec<TextRun>

Inline styled runs. When non-empty, content is ignored.

§

Image

An image node.

Fields

§src: String

Base64-encoded image data, or a file path.

§width: Option<f64>

Image width in points (optional, will use intrinsic if not set).

§height: Option<f64>

Image height in points (optional, will use intrinsic if not set).

§

Table

A table container. Children should be TableRow nodes.

Fields

§columns: Vec<ColumnDef>

Column width definitions. If omitted, columns distribute evenly.

§

TableRow

A row inside a Table.

Fields

§is_header: bool

If true, this row repeats at the top of each page when the table breaks across pages. This is the killer feature.

§

TableCell

A cell inside a TableRow.

Fields

§col_span: u32

Column span.

§row_span: u32

Row span.

§

Fixed

A fixed element that repeats on every page (headers, footers, page numbers).

Fields

§position: FixedPosition

Where to place this element on the page.

§

PageBreak

An explicit page break.

§

Svg

An SVG element rendered as vector graphics.

Fields

§width: f64

Display width in points.

§height: f64

Display height in points.

§view_box: Option<String>

Optional viewBox (e.g. “0 0 100 100”).

§content: String

SVG markup content (the inner XML).

§

Canvas

A canvas drawing primitive with arbitrary vector operations.

Fields

§width: f64

Display width in points.

§height: f64

Display height in points.

§operations: Vec<CanvasOp>

Drawing operations to execute.

§

Barcode

A 1D barcode rendered as vector rectangles.

Fields

§data: String

The data to encode.

§format: BarcodeFormat

Barcode format (Code128, Code39, EAN13, EAN8, Codabar). Default: Code128.

§width: Option<f64>

Width in points. Defaults to available width.

§height: f64

Height in points. Default: 60.

§

QrCode

A QR code rendered as vector rectangles.

Fields

§data: String

The data to encode (URL, text, etc.).

§size: Option<f64>

Display size in points (QR codes are always square). Defaults to available width if omitted.

§

BarChart

A bar chart rendered as native vector graphics.

Fields

§data: Vec<ChartDataPoint>

Data points with labels and values.

§width: f64

Chart width in points.

§height: f64

Chart height in points.

§color: Option<String>

Bar color (hex string). Defaults to “#1a365d”.

§show_labels: bool

Show X-axis labels below bars.

§show_values: bool

Show value labels above bars.

§show_grid: bool

Show horizontal grid lines.

§title: Option<String>

Optional chart title.

§

LineChart

A line chart rendered as native vector graphics.

Fields

§series: Vec<ChartSeries>

Data series (each with name, data points, optional color).

§labels: Vec<String>

X-axis labels.

§width: f64

Chart width in points.

§height: f64

Chart height in points.

§show_points: bool

Show dots at data points.

§show_grid: bool

Show horizontal grid lines.

§title: Option<String>

Optional chart title.

§

PieChart

A pie chart rendered as native vector graphics.

Fields

§data: Vec<ChartDataPoint>

Data points with labels, values, and optional colors.

§width: f64

Chart width in points.

§height: f64

Chart height in points.

§donut: bool

Whether to render as donut (hollow center).

§show_legend: bool

Show legend.

§title: Option<String>

Optional chart title.

§

AreaChart

An area chart rendered as native vector graphics.

Fields

§series: Vec<ChartSeries>

Data series (each with name, data points, optional color).

§labels: Vec<String>

X-axis labels.

§width: f64

Chart width in points.

§height: f64

Chart height in points.

§show_grid: bool

Show horizontal grid lines.

§title: Option<String>

Optional chart title.

§

DotPlot

A dot plot (scatter plot) rendered as native vector graphics.

Fields

§groups: Vec<DotPlotGroup>

Groups of data points.

§width: f64

Chart width in points.

§height: f64

Chart height in points.

§x_min: Option<f64>

Minimum X value. Auto-computed if not set.

§x_max: Option<f64>

Maximum X value. Auto-computed if not set.

§y_min: Option<f64>

Minimum Y value. Auto-computed if not set.

§y_max: Option<f64>

Maximum Y value. Auto-computed if not set.

§x_label: Option<String>

X-axis label.

§y_label: Option<String>

Y-axis label.

§show_legend: bool

Show legend.

§dot_size: f64

Dot radius in points.

§

Watermark

A watermark rendered as rotated text behind page content.

Fields

§text: String

The watermark text (e.g. “DRAFT”, “CONFIDENTIAL”).

§font_size: f64

Font size in points. Default: 60.

§angle: f64

Rotation angle in degrees (negative = counterclockwise). Default: -45.

§

TextField

An interactive text input field (PDF AcroForm widget).

Fields

§name: String

Field name, used for data extraction.

§value: Option<String>

Default/current value.

§placeholder: Option<String>

Placeholder text displayed when empty.

§width: f64

Field width in points.

§height: f64

Field height in points. Default: 24.

§multiline: bool

Allow multiple lines of input.

§password: bool

Mask input as password dots.

§read_only: bool

Prevent editing.

§max_length: Option<u32>

Maximum number of characters.

§font_size: f64

Font size in points. Default: 12.

§

Checkbox

An interactive checkbox (PDF AcroForm widget).

Fields

§name: String

Field name, used for data extraction.

§checked: bool

Default checked state.

§width: f64

Checkbox width in points. Default: 14.

§height: f64

Checkbox height in points. Default: 14.

§read_only: bool

Prevent editing.

§

Dropdown

An interactive dropdown/combo box (PDF AcroForm widget).

Fields

§name: String

Field name, used for data extraction.

§options: Vec<String>

Available options.

§value: Option<String>

Default selected value.

§width: f64

Field width in points.

§height: f64

Field height in points. Default: 24.

§read_only: bool

Prevent editing.

§font_size: f64

Font size in points. Default: 12.

§

RadioButton

An interactive radio button (PDF AcroForm widget). Multiple RadioButtons with the same name form a mutually exclusive group.

Fields

§name: String

Group name shared by all buttons in the group.

§value: String

This button’s export value.

§checked: bool

Default selected state.

§width: f64

Button width in points. Default: 14.

§height: f64

Button height in points. Default: 14.

§read_only: bool

Prevent editing.

Trait Implementations§

Source§

impl Clone for NodeKind

Source§

fn clone(&self) -> NodeKind

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for NodeKind

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<'de> Deserialize<'de> for NodeKind

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl Serialize for NodeKind

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

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

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

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.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,