Skip to main content

JsonUiConfig

Struct JsonUiConfig 

Source
pub struct JsonUiConfig {
    pub tailwind_cdn: bool,
    pub stylesheet_urls: Vec<String>,
    pub custom_head: Option<String>,
    pub body_class: String,
}
Expand description

Configuration for JSON-UI HTML rendering.

§Example

use ferro_json_ui::JsonUiConfig;

// Default: framework-served base CSS with cache-busting version, no Tailwind CDN.
let default_config = JsonUiConfig::new();
assert!(default_config.stylesheet_urls[0].starts_with("/_ferro/ferro-base.css"));
assert!(!default_config.tailwind_cdn);

// Opt into CDN for dev, and override stylesheet list:
let dev_config = JsonUiConfig::new()
    .tailwind_cdn(true)
    .stylesheet_urls(vec!["/custom.css".to_string()]);

Fields§

§tailwind_cdn: bool

Include Tailwind CDN link in rendered HTML (dev convenience).

Default: false. Set to true to load the Tailwind v4 browser runtime from cdn.jsdelivr.net. The runtime is a development convenience per Tailwind’s docs — it does not work reliably on Safari/WebKit. Production apps rely on the pre-built base CSS served via stylesheet_urls.

§stylesheet_urls: Vec<String>

Stylesheet URLs emitted as <link rel="stylesheet" href="..."> in <head>, in order.

Default: vec!["/_ferro/ferro-base.css".to_string()] — the framework-served pre-built base CSS. Apps override this list to inject additional stylesheets (e.g., app-level theme token files) or to drop the default entirely.

§custom_head: Option<String>

Custom content to inject into the <head> element.

§body_class: String

Default CSS classes for the <body> element.

Implementations§

Source§

impl JsonUiConfig

Source

pub fn new() -> Self

Create a new configuration with default values.

Source

pub fn tailwind_cdn(self, enabled: bool) -> Self

Enable or disable Tailwind CDN inclusion.

Source

pub fn stylesheet_urls(self, urls: Vec<String>) -> Self

Replace the stylesheet URL list.

Each URL emits a <link rel="stylesheet" href="..."> in <head>, in order. Default: ["/_ferro/ferro-base.css"].

Pass an empty Vec to disable the framework-served base CSS.

Source

pub fn custom_head(self, head: impl Into<String>) -> Self

Set custom content to inject into the <head> element.

Source

pub fn body_class(self, class: impl Into<String>) -> Self

Set the default CSS classes for the <body> element.

Trait Implementations§

Source§

impl Clone for JsonUiConfig

Source§

fn clone(&self) -> JsonUiConfig

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 JsonUiConfig

Source§

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

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

impl Default for JsonUiConfig

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl JsonSchema for JsonUiConfig

Source§

fn schema_name() -> Cow<'static, str>

The name of the generated JSON Schema. Read more
Source§

fn schema_id() -> Cow<'static, str>

Returns a string that uniquely identifies the schema produced by this type. Read more
Source§

fn json_schema(generator: &mut SchemaGenerator) -> Schema

Generates a JSON Schema for this type. Read more
Source§

fn inline_schema() -> bool

Whether JSON Schemas generated for this type should be included directly in parent schemas, rather than being re-used where possible using the $ref keyword. 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> DynClone for T
where T: Clone,

Source§

fn __clone_box(&self, _: Private) -> *mut ()

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