NAME
bud/bud.h - HTML tree builder and patch runtime.
SYNOPSIS
#include <stddef.h>
#include <stdarg.h>
Data Structures
A DOM event dispatched through a bud runtime.
A renderable component.
One state-field definition driving JSON→state binding.
Macros
Empty placeholder when BUD_DEBUG is not defined.
Typedefs
Node kinds in a bud tree.
Opaque DOM node handle.
Opaque runtime handle managing a node tree lifecycle.
Callback invoked per emitted patch operation.
Callback resolving a hydrated node id to its DOM metadata.
Callback invoked when the runtime is invalidated.
A DOM event dispatched through a bud runtime.
Event handler signature.
Node lifecycle callback.
Component render function signature.
A renderable component.
Opaque bump-allocator arena for per-render bud_node trees.
One state-field definition driving JSON→state binding.
Enumerations
Node kinds in a bud tree.
Functions
Create an empty fragment node.
Create an element node.
Create an element node with a static-lifetime tag string (zero-copy).
Create a text node (HTML-escaped on render).
Create a text node with a static-lifetime string (zero-copy).
Create a text node from a printf-style format.
Create a hidden input element carrying a name/value pair.
Create a hidden input element carrying an integer value.
Create a submit button element with an optional class.
Create an anchor element.
Create a raw-HTML node emitted verbatim (no escaping).
Create a raw-HTML node from a printf-style format.
Create a raw-HTML node from a format and va_list.
Replace a raw node's text without touching child nodes.
Render a component instance.
Set an attribute on a node.
Set an attribute with static-lifetime name and value (zero-copy).
Set an attribute with a static-lifetime name and copied value.
Set an attribute from a printf-style format.
Set a boolean (valueless) attribute on a node.
Set a boolean attribute with a static-lifetime name (zero-copy).
Read an attribute value.
Add a CSS class to a node.
Remove a CSS class from a node.
Toggle a CSS class on a node.
Detach a node from its parent.
Mark a node as listening for an event.
Bind an event handler to a node.
Bind an event handler with optional inline-copied context payload.
Bind an event handler with a static-lifetime event name (zero-copy).
Create a lazy component virtual node with inline-copied props.
Dispatch a UI action encoded in the event.
Attach lifecycle callbacks to a node.
Append a child to a parent node.
Kind of a node.
Tag name of an element node.
Text content of a text node.
Stable id of a node.
Number of children of a node.
Child at an index.
Parent of a node.
Number of attributes on a node.
Attribute name at an index.
Attribute value at an index.
Number of listeners on a node.
Event type of a listener at an index.
Bubble flag of a listener at an index.
Recursively expand all BUD_NODE_COMPONENT nodes in a tree in-place.
Render a node tree to HTML.
Render a node tree to hydration HTML with data-hook ids.
Emit patch operations for a full render.
Emit hydration operations for a fresh mount.
Emit patch operations to bring a server-rendered tree up to date.
Diff two trees and emit minimal patch operations.
Signal that application state has changed (triggers re-render).
Hydrate a server-rendered tree into DOM nodes.
Create a runtime owning a node tree.
Free a runtime and its tree.
Root node of a runtime.
Install an invalidation callback on a runtime.
Mark a runtime dirty.
Query whether a runtime is dirty.
Flush pending patch operations.
Mount the runtime root into the live document.
Apply a full update pass.
Unmount the runtime root.
Dispatch an event through a runtime.
Stop an event from propagating further.
Prevent an event's default action.
Free a node tree.
Free a string returned by a bud_render_* function.
Create a new bump arena.
Activate an arena for subsequent bud_node allocations on this thread.
Restore the previously active arena returned by bud_arena_push().
Return the currently active arena on this thread, or NULL.
Reset an arena for reuse, invalidating all nodes allocated from it.
Free an arena and all slabs it owns.
Return total bytes bumped from the arena since creation or last reset.
Extract a string field from NUL-terminated JSON.
Extract a string field from length-bounded JSON.
Extract an integer field from NUL-terminated JSON.
Extract an integer field from length-bounded JSON.
Extract the raw data"stringfieldfromNUL-terminatedJSON.
Extract the raw data"stringfieldfromlength-boundedJSON.
Iterate over a top-level JSON array (NUL-terminated).
Iterate over a top-level JSON array (length-bounded).
Iterate over the array stored under a named key.
Apply JSON fields onto a state struct (fully flexible).
Apply length-bounded JSON fields onto a state struct.
Apply JSON onto a state struct with caller-specified field stride.
Apply length-bounded JSON with caller-specified field stride.
Populate a fixed-capacity array from a JSON array field.
Populate a fixed-capacity array from a length-bounded JSON array.
Populate a fixed-capacity array with caller-specified schema stride.
Stamp a debug source location onto a node.
Read a node's stamped source file.
Render a compact ASCII tree dump for debugging.
Detailed Description
HTML tree builder and patch runtime.
Builds DOM nodes in C and reconciles them against a live document via minimal patch operations; pure and isomorphic (SSR + WASM).
Typedef Documentation
typedef struct bud_arena bud_arena
Opaque bump-allocator arena for per-render bud_node trees. While pushed via bud_arena_push(), node/attr/listener/props/string allocations are bumped from contiguous growing slabs rather than individual malloc/calloc calls. Calling bud_arena_reset() or bud_arena_free() tears down the entire tree in O(slabs) without walking nodes. Calling bud_free() on arena nodes remains safe (lifecycle unmount runs; arena slabs stay intact).
typedef bud_node *(* bud_component_fn) (void *ctx, const void *props)
Component render function signature.
Parameters
ctx Component context.
props Immutable props.
Returns
The rendered node subtree.
typedef int(* bud_emit_fn) (void *user, const char *op, const char *a, const char *b, const char *c)
Callback invoked per emitted patch operation.
Parameters
user Arbitrary caller data.
op Operation name (e.g. "append", "set_attr").
a First operand.
b Second operand.
c Third operand.
Returns
Non-zero to abort emission.
typedef int(* bud_event_handler_fn) (bud_event *event)
Event handler signature.
Parameters
event Event being dispatched.
Returns
Non-zero to stop propagation.
typedef int(* bud_hydrate_lookup_fn) (void *user, unsigned int id, const char **kind, const char **tag, const char **text)
Callback resolving a hydrated node id to its DOM metadata.
Parameters
user Arbitrary caller data.
id Node id.
kind Receives the node kind.
tag Receives the element tag.
text Receives the text content.
Returns
Non-zero on success.
typedef void(* bud_lifecycle_fn) (void *user, bud_runtime *runtime, const bud_node *node)
Node lifecycle callback.
Parameters
user Arbitrary caller data.
runtime Owning runtime.
node Node entering/leaving the tree.
typedef void(* bud_runtime_invalidate_fn) (void *user, bud_runtime *runtime)
Callback invoked when the runtime is invalidated.
Parameters
user Arbitrary caller data.
runtime Invalidated runtime.
Enumeration Type Documentation
enum bud_node_kind
Node kinds in a bud tree.
Enumerator
- BUD_NODE_FRAGMENT
- Document fragment grouping child nodes without an element wrapper.
- BUD_NODE_ELEMENT
- Element node with a tag name.
- BUD_NODE_TEXT
- Text node whose contents are HTML-escaped on render.
- BUD_NODE_RAW_HTML
- Raw HTML node emitted verbatim without escaping.
- BUD_NODE_COMPONENT
- Lazy component node expanded on reconcile or SSR.
Function Documentation
int bud_add_class (bud_node * node, const char * cls)
Add a CSS class to a node.
Parameters
node Target node.
cls Class name.
Returns
0 on success.
int bud_api_action_handler (bud_event * event)
Dispatch a UI action encoded in the event.
Parameters
event Event to dispatch.
Returns
0 on success.
int bud_append (bud_node * parent, bud_node * child)
Append a child to a parent node.
Parameters
parent Parent node.
child Child node.
Returns
0 on success.
void bud_arena_free (bud_arena * arena)
Free an arena and all slabs it owns.
Parameters
arena Target arena (NULL is a no-op).
bud_arena * bud_arena_new (size_t initial_cap)
Create a new bump arena.
Parameters
initial_cap Initial slab capacity in bytes (0 = default 8192).
Returns
New arena, or NULL on allocation failure.
void bud_arena_pop (bud_arena * prev)
Restore the previously active arena returned by bud_arena_push().
Parameters
prev Arena pointer returned by the matching bud_arena_push().
bud_arena * bud_arena_push (bud_arena * arena)
Activate an arena for subsequent bud_node allocations on this thread.
Parameters
arena Arena to activate (or NULL to allocate from heap).
Returns
Previously active arena (pass to bud_arena_pop() to restore).
void bud_arena_reset (bud_arena * arena)
Reset an arena for reuse, invalidating all nodes allocated from it.
Parameters
arena Target arena (NULL is a no-op).
int bud_bind (bud_node * node, const char * event, int bubbles, bud_event_handler_fn handler)
Bind an event handler to a node.
Parameters
node Target node.
event Event type.
bubbles Non-zero to bubble.
handler Handler callback.
Returns
0 on success.
int bud_bind_ctx (bud_node * node, const char * event, int bubbles, bud_event_handler_fn handler, const void * ctx, size_t ctx_size)
Bind an event handler with optional inline-copied context payload.
Parameters
node Target node.
event Event type.
bubbles Non-zero to bubble.
handler Handler callback.
ctx Context payload pointer (may be NULL).
ctx_size Byte size to copy inline (0 to store ctx pointer as-is).
Returns
0 on success.
bud_node * bud_component_render (const bud_component * component, const void * props)
Render a component instance.
Parameters
component Component to render.
props Immutable props.
Returns
Rendered node subtree.
bud_node * bud_component_vnode (bud_component_fn fn, void * ctx, const void * props, size_t props_size)
Create a lazy component virtual node with inline-copied props.
Parameters
fn Component render function.
ctx Optional component context pointer.
props Pointer to props struct (may be stack-allocated or NULL).
props_size Byte size of props struct (0 when props is NULL).
Returns
New component node, or NULL on allocation failure.
int bud_detach (bud_node * node)
Detach a node from its parent.
Parameters
node Node to detach.
Returns
0 on success.
bud_node * bud_element (const char * tag)
Create an element node.
Parameters
tag Element tag name.
Returns
New element node.
bud_node * bud_element_lit (const char * tag_lit)
Create an element node with a static-lifetime tag string (zero-copy).
Parameters
tag_lit Static string literal tag name (not copied or freed).
Returns
New element node.
void bud_event_prevent_default (bud_event * event)
Prevent an event's default action.
Parameters
event Event to cancel.
void bud_event_stop_propagation (bud_event * event)
Stop an event from propagating further.
Parameters
event Event to stop.
bud_node * bud_expand_tree (bud_node * root)
Recursively expand all BUD_NODE_COMPONENT nodes in a tree in-place. Takes ownership of root (freeing replaced component shells) and returns the expanded root node, or NULL if a root component expands to NULL.
Parameters
root Root node of the tree to expand.
Returns
Expanded root node, or NULL.
bud_node * bud_fragment (void )
Create an empty fragment node.
Returns
New fragment node.
void bud_free (bud_node * node)
Free a node tree.
Parameters
node Root node to free.
void bud_free_string (char * value)
Free a string returned by a bud_render_* function.
Parameters
value String to free.
const char * bud_get_attr (const bud_node * node, const char * name)
Read an attribute value.
Parameters
node Target node.
name Attribute name.
Returns
Attribute value, or NULL when absent.
bud_node * bud_hidden_input (const char * name, const char * value)
Create a hidden input element carrying a name/value pair.
Parameters
name Input name.
value Input value.
Returns
New input element node.
bud_node * bud_hidden_input_int (const char * name, int value)
Create a hidden input element carrying an integer value.
Parameters
name Input name.
value Integer value (serialized as text).
Returns
New input element node.
int bud_hydrate (const bud_node * root, bud_hydrate_lookup_fn lookup, void * user)
Hydrate a server-rendered tree into DOM nodes.
Parameters
root Root node.
lookup Hydration lookup callback.
user Caller data passed to lookup.
Returns
0 on success.
int bud_json_array_for_each (const char * json, void(* fn )(const char *elem, size_t len, void *user), void * user)
Iterate over a top-level JSON array (NUL-terminated).
Parameters
json NUL-terminated JSON array.
fn Callback per element (borrowed, length-bounded).
user Caller data passed to fn.
Returns
Number of elements visited, or -1 on parse failure.
int bud_json_array_for_each_key_len (const char * json, size_t len, const char * key, void(* fn )(const char *elem, size_t len, void *user), void * user)
Iterate over the array stored under a named key.
Parameters
json JSON bytes.
len Byte length of json.
key Field name holding the array.
fn Callback per element (borrowed, length-bounded).
user Caller data passed to fn.
Returns
Number of elements visited, or -1 on parse failure.
int bud_json_array_for_each_len (const char * json, size_t len, void(* fn )(const char *elem, size_t len, void *user), void * user)
Iterate over a top-level JSON array (length-bounded).
Parameters
json JSON array bytes.
len Byte length of json.
fn Callback per element (borrowed, length-bounded).
user Caller data passed to fn.
Returns
Number of elements visited, or -1 on parse failure.
void bud_json_data (const char * json, char * out, size_t out_size)
Extract the raw "data" string field from NUL-terminated JSON.
Parameters
json NUL-terminated JSON.
out Destination buffer.
out_size Capacity of out.
void bud_json_data_len (const char * json, size_t len, char * out, size_t out_size)
Extract the raw "data" string field from length-bounded JSON.
Parameters
json JSON bytes.
len Byte length of json.
out Destination buffer.
out_size Capacity of out.
int bud_json_int (const char * json, const char * key, int default_val)
Extract an integer field from NUL-terminated JSON.
Parameters
json NUL-terminated JSON.
key Field name.
default_val Value when the field is absent or not an integer.
Returns
Parsed integer.
int bud_json_int_len (const char * json, size_t len, const char * key, int default_val)
Extract an integer field from length-bounded JSON.
Parameters
json JSON bytes.
len Byte length of json.
key Field name.
default_val Value when the field is absent or not an integer.
Returns
Parsed integer.
void bud_json_str (const char * json, const char * key, char * out, size_t out_size)
Extract a string field from NUL-terminated JSON.
Parameters
json NUL-terminated JSON.
key Field name.
out Destination buffer.
out_size Capacity of out (NUL-terminated when > 0).
void bud_json_str_len (const char * json, size_t len, const char * key, char * out, size_t out_size)
Extract a string field from length-bounded JSON.
Parameters
json JSON bytes.
len Byte length of json.
key Field name.
out Destination buffer.
out_size Capacity of out (NUL-terminated when > 0).
bud_node * bud_link (const char * href, const char * text, const char * class_name)
Create an anchor element.
Parameters
href Target URL.
text Link text.
class_name CSS class, or NULL.
Returns
New anchor element node.
size_t bud_node_attr_count (const bud_node * node)
Number of attributes on a node.
Parameters
node Target node.
Returns
Attribute count.
const char * bud_node_attr_name (const bud_node * node, size_t index)
Attribute name at an index.
Parameters
node Target node.
index Attribute index.
Returns
Attribute name.
const char * bud_node_attr_value (const bud_node * node, size_t index)
Attribute value at an index.
Parameters
node Target node.
index Attribute index.
Returns
Attribute value.
const bud_node * bud_node_child (const bud_node * node, size_t index)
Child at an index.
Parameters
node Target node.
index Child index.
Returns
Child node, or NULL when out of range.
size_t bud_node_child_count (const bud_node * node)
Number of children of a node.
Parameters
node Target node.
Returns
Child count.
const char * bud_node_get_src (const bud_node * node)
Read a node's stamped source file.
Parameters
node Target node.
Returns
Source file name, or NULL.
unsigned int bud_node_id (const bud_node * node)
Stable id of a node.
Parameters
node Target node.
Returns
Node id.
bud_node_kind bud_node_kind_of (const bud_node * node)
Kind of a node.
Parameters
node Target node.
Returns
Node kind.
int bud_node_listener_bubbles (const bud_node * node, size_t index)
Bubble flag of a listener at an index.
Parameters
node Target node.
index Listener index.
Returns
Non-zero when the listener bubbles.
size_t bud_node_listener_count (const bud_node * node)
Number of listeners on a node.
Parameters
node Target node.
Returns
Listener count.
const char * bud_node_listener_event (const bud_node * node, size_t index)
Event type of a listener at an index.
Parameters
node Target node.
index Listener index.
Returns
Event type.
bud_node * bud_node_parent (const bud_node * node)
Parent of a node.
Parameters
node Target node.
Returns
Parent node, or NULL for roots.
void bud_node_set_src (bud_node * node, const char * file, int line)
Stamp a debug source location onto a node.
Parameters
node Target node.
file Source file name.
line Source line number.
const char * bud_node_tag (const bud_node * node)
Tag name of an element node.
Parameters
node Target node.
Returns
Tag name, or NULL for non-elements.
const char * bud_node_text (const bud_node * node)
Text content of a text node.
Parameters
node Target node.
Returns
Text, or NULL for non-text nodes.
int bud_on (bud_node * node, const char * event, int bubbles)
Mark a node as listening for an event.
Parameters
node Target node.
event Event type.
bubbles Non-zero to bubble.
Returns
0 on success.
bud_node * bud_raw (const char * html)
Create a raw-HTML node emitted verbatim (no escaping).
Parameters
html Raw markup.
Returns
New raw-HTML node.
void bud_raw_set_text (bud_node * node, const char * text)
Replace a raw node's text without touching child nodes.
Parameters
node Root node.
text Replacement text.
int bud_remove_class (bud_node * node, const char * cls)
Remove a CSS class from a node.
Parameters
node Target node.
cls Class name.
Returns
0 on success.
char * bud_render_html (const bud_node * root)
Render a node tree to HTML.
Parameters
root Root node.
Returns
malloc'd HTML string (free with bud_free_string), or NULL.
char * bud_render_hydrated_html (const bud_node * root)
Render a node tree to hydration HTML with data-hook ids.
Parameters
root Root node.
Returns
malloc'd HTML string, or NULL.
int bud_render_hydration_ops (const bud_node * root, bud_emit_fn emit, void * user)
Emit hydration operations for a fresh mount.
Parameters
root Root node.
emit Emission callback.
user Caller data passed to emit.
Returns
0 on success.
int bud_render_ops (const bud_node * root, bud_emit_fn emit, void * user)
Emit patch operations for a full render.
Parameters
root Root node.
emit Emission callback.
user Caller data passed to emit.
Returns
0 on success.
int bud_render_patch_ops (const bud_node * root, bud_emit_fn emit, void * user)
Emit patch operations to bring a server-rendered tree up to date.
Parameters
root Root node.
emit Emission callback.
user Caller data passed to emit.
Returns
0 on success.
int bud_runtime_dispatch (bud_runtime * runtime, bud_node * target, const char * event, void * event_user)
Dispatch an event through a runtime.
Parameters
runtime Target runtime.
target Receiving node.
event Event type.
event_user Caller data attached to the event.
Returns
0 on success.
int bud_runtime_flush (bud_runtime * runtime)
Flush pending patch operations.
Parameters
runtime Target runtime.
Returns
0 on success.
void bud_runtime_free (bud_runtime * runtime)
Free a runtime and its tree.
Parameters
runtime Runtime to free.
int bud_runtime_is_dirty (const bud_runtime * runtime)
Query whether a runtime is dirty.
Parameters
runtime Target runtime.
Returns
Non-zero when dirty.
int bud_runtime_mark_dirty (bud_runtime * runtime)
Mark a runtime dirty.
Parameters
runtime Target runtime.
Returns
0 on success.
int bud_runtime_mount (bud_runtime * runtime)
Mount the runtime root into the live document.
Parameters
runtime Target runtime.
Returns
0 on success.
bud_runtime * bud_runtime_new (bud_node * root)
Create a runtime owning a node tree.
Parameters
root Root node.
Returns
New runtime.
bud_node * bud_runtime_root (const bud_runtime * runtime)
Root node of a runtime.
Parameters
runtime Target runtime.
Returns
Root node.
int bud_runtime_set_invalidate (bud_runtime * runtime, bud_runtime_invalidate_fn fn, void * user)
Install an invalidation callback on a runtime.
Parameters
runtime Target runtime.
fn Callback, or NULL to clear.
user Caller data passed to fn.
Returns
0 on success.
int bud_runtime_unmount (bud_runtime * runtime)
Unmount the runtime root.
Parameters
runtime Target runtime.
Returns
0 on success.
int bud_runtime_update (bud_runtime * runtime)
Apply a full update pass.
Parameters
runtime Target runtime.
Returns
0 on success.
int bud_set_attr (bud_node * node, const char * name, const char * value)
Set an attribute on a node.
Parameters
node Target node.
name Attribute name.
value Attribute value.
Returns
0 on success.
int bud_set_attr_fmt (bud_node * node, const char * name, const char * fmt, ...)
Set an attribute from a printf-style format.
Parameters
node Target node.
name Attribute name.
fmt Format string.
Returns
0 on success.
int bud_set_bool_attr (bud_node * node, const char * name)
Set a boolean (valueless) attribute on a node.
Parameters
node Target node.
name Attribute name.
Returns
0 on success.
int bud_set_lifecycle (bud_node * node, bud_lifecycle_fn on_mount, bud_lifecycle_fn on_update, bud_lifecycle_fn on_unmount, void * user)
Attach lifecycle callbacks to a node.
Parameters
node Target node.
on_mount Mount callback, or NULL.
on_update Update callback, or NULL.
on_unmount Unmount callback, or NULL.
user Caller data passed to each callback.
Returns
0 on success.
int bud_sprint_tree (const bud_node * root, char * buf, size_t bufsz)
Render a compact ASCII tree dump for debugging.
Parameters
root Root node.
buf Destination buffer.
bufsz Capacity of buf.
Returns
Bytes written, or -1 when truncated.
void bud_state_apply (void * state, const bud_field_desc_t * fields, const char * json)
Apply JSON fields onto a state struct (fully flexible).
Parameters
state Destination struct.
fields Field descriptor array, NULL-key terminated.
json NUL-terminated JSON.
void bud_state_apply_array (const char * json, const char * key, void * array_out, size_t elem_size, int * count_out, int max_elems, const bud_field_desc_t * schema)
Populate a fixed-capacity array from a JSON array field.
Parameters
json NUL-terminated JSON.
key Field name holding the array.
array_out Destination array.
elem_size Byte size of one element.
count_out In: capacity hint; out: filled count.
max_elems Hard element cap.
schema Per-field descriptors for each element.
void bud_state_apply_array_len (const char * json, size_t len, const char * key, void * array_out, size_t elem_size, int * count_out, int max_elems, const bud_field_desc_t * schema)
Populate a fixed-capacity array from a length-bounded JSON array.
Parameters
json JSON bytes.
len Byte length of json.
key Field name holding the array.
array_out Destination array.
elem_size Byte size of one element.
count_out In: capacity hint; out: filled count.
max_elems Hard element cap.
schema Per-field descriptors for each element.
void bud_state_apply_array_stride_len (const char * json, size_t len, const char * key, void * array_out, size_t elem_size, int * count_out, int max_elems, const void * schema, size_t schema_stride)
Populate a fixed-capacity array with caller-specified schema stride.
Parameters
json JSON bytes.
len Byte length of json.
key Field name holding the array.
array_out Destination array.
elem_size Byte size of one element.
count_out In: capacity hint; out: filled count.
max_elems Hard element cap.
schema Per-field descriptors for each element.
schema_stride Stride between element descriptors.
void bud_state_apply_len (void * state, const bud_field_desc_t * fields, const char * json, size_t len)
Apply length-bounded JSON fields onto a state struct.
Parameters
state Destination struct.
fields Field descriptor array, NULL-key terminated.
json JSON bytes.
len Byte length of json.
void bud_state_apply_stride (void * state, const void * fields, size_t field_stride, const char * json)
Apply JSON onto a state struct with caller-specified field stride.
Parameters
state Destination struct.
fields Field descriptors.
field_stride Stride between descriptors.
json NUL-terminated JSON.
void bud_state_apply_stride_len (void * state, const void * fields, size_t field_stride, const char * json, size_t len)
Apply length-bounded JSON with caller-specified field stride.
Parameters
state Destination struct.
fields Field descriptors.
field_stride Stride between descriptors.
json JSON bytes.
len Byte length of json.
bud_node * bud_submit_btn (const char * label, const char * class_name)
Create a submit button element with an optional class.
Parameters
label Button label.
class_name CSS class, or NULL.
Returns
New button element node.
bud_node * bud_text (const char * text)
Create a text node (HTML-escaped on render).
Parameters
text Text content.
Returns
New text node.
bud_node * bud_text_lit (const char * text_lit)
Create a text node with a static-lifetime string (zero-copy).
Parameters
text_lit Static string literal text (not copied or freed).
Returns
New text node.
bud_node * bud_textf (const char * fmt, ...)
Create a text node from a printf-style format.
Parameters
fmt Format string.
Returns
New text node.
int bud_toggle_class (bud_node * node, const char * cls)
Toggle a CSS class on a node.
Parameters
node Target node.
cls Class name.
Returns
0 on success.
bud_node * bud_tpl (const char * fmt, ...)
Create a raw-HTML node from a printf-style format.
Parameters
fmt Format string.
Returns
New raw-HTML node.
int bud_vdom_diff (bud_node * old_root, bud_node * new_root, bud_emit_fn emit, void * user)
Diff two trees and emit minimal patch operations.
Parameters
old_root Previous tree.
new_root New tree.
emit Emission callback.
user Caller data passed to emit.
Returns
0 on success.
bud_node * bud_vtpl (const char * fmt, va_list ap)
Create a raw-HTML node from a format and va_list.
Parameters
fmt Format string.
ap Argument list.
Returns
New raw-HTML node.
Author
Generated automatically by Doxygen for bud from the source code.