Skip to main content

Crate zeyn

Crate zeyn 

Source
Expand description

§Zeyn Framework

A Rust web framework for data heavy applications. AI agents write the application code; people read it, review it and change it. The language is kept small, typed and has one way to do each thing.

use zeyn::prelude::*;

#[entity(table = "products")]
pub struct Product {
    #[key]
    pub id: ProductId,
    #[rule(required, max_len = 20)]
    pub code: String,
}

#[action(permission = "stock.product.read")]
pub async fn search_products(_q: DataQuery) -> Result<Page<Product>> {
    Ok(Page::default())
}

#[screen(route = "/products", permission = "stock.product.read")]
pub fn product_list() -> Screen {
    Screen::new("Products").body(DataGrid::of(search_products).column(Product::code).filter())
}

§Mistakes that do not compile

The compiler refuses these, with an error message that says what to change. Each one has a compile_fail test in src/compile_fail.rs:

  • an action without access
  • a shared cache on a screen that is not public, and one longer than a day
  • a text rule on a field that is not text
  • a form whose submit action does not take Valid<M>
  • a route segment that names no field of the screen’s params
  • a route with segments on a screen that takes no params
  • a total on a text column
  • an average on a text column, and a minimum on a yes/no column
  • a badge on a column that is not a #[choice] enum
  • a row action whose input is not built from the row the way the action takes it
  • a bulk action whose input does not hold keys of the given key field
  • an inline edit save action that does not take Valid<M>
  • a menu item for a screen without a route
  • a key on a model that is not an entity
  • a scale rule on a field that is not a Decimal
  • a Vec of something that is neither a line model nor a #[choice] enum
  • a mask rule on a field that is not text
  • a mask on a field that is not text
  • an unknown action option (the AI options are ai = "...", ai = false and confirm)
  • empty guidance for models

§Extension points

  • Component: any type that renders HTML and describes itself in the schema can go on a screen.
  • FieldType: new field types; use FieldKind::Custom to name a client side editor.
  • Models, actions and screens from other crates are used like local ones.

Re-exports§

pub use audit::ExportRecord;
pub use audit::FieldChange;
pub use audit::FieldRef;
pub use audit::RecordRef;
pub use audit::Trail;
pub use auth::RequireMfa;
pub use render::Render;
pub use screen::Component;
pub use screen::Effect;
pub use screen::Export;
pub use screen::FormSource;
pub use screen::GridSource;
pub use screen::Icon;
pub use screen::LoadedPage;
pub use screen::MAX_SCREEN_CACHE;
pub use screen::MAX_SEGMENT;
pub use screen::MAX_TOASTS;
pub use screen::Node;
pub use screen::Params;
pub use screen::PathValue;
pub use screen::RowCall;
pub use screen::Screen;
pub use screen::ScreenDef;
pub use screen::ScreenMeta;
pub use screen::Toast;
pub use screen::ToolButton;
pub use screen::Toolbar;
pub use screen::UiCtx;
pub use screen::Window;
pub use screen::route_has_segments;
pub use screen::screen_url;
pub use server::ApiDocs;
pub use server::App;
pub use server::AuditEntry;
pub use server::AuditLog;
pub use server::AuditSink;
pub use server::Authenticator;
pub use server::BasicCredentials;
pub use server::Call;
pub use server::CallKind;
pub use server::CallOutcome;
pub use server::DevAuth;
pub use server::ForwardAuth;
pub use server::HeaderTenant;
pub use server::Interceptor;
pub use server::Mcp;
pub use server::MemoryAudit;
pub use server::Plugin;
pub use server::Prefetch;
pub use server::READY_CACHE;
pub use server::StaticCredentials;
pub use server::StderrAudit;
pub use server::SubdomainTenant;
pub use server::TenantResolver;
pub use server::Theme;
pub use server::TimePolicy;
pub use server::probe;

Modules§

audit
Field level data audit: which record a call saved, which fields changed and how.
auth
Sign in beyond a proxy in front of the app: bearer JWTs for APIs and MCP ([JwtAuth], Cargo feature oidc), OpenID Connect sign in for browsers ([OidcAuth], feature oidc), a second factor guard (RequireMfa) and a built in TOTP second factor ([Totp], feature totp). See docs/auth.md.
prelude
Everything application code needs: use zeyn::prelude::*;
render
seo
Head tags for search engines and the sitemap. Head tags for search engines and link previews, and the sitemap.
server
HTTP server: page shell, screen, grid, form, language and agent endpoints.
text
Text in the form search compares. fold is what free text search (crate::DataQuery::q) uses on both sides, in memory and in SQL; use it for search key columns too, so a key written by the app matches what users type.
ui
Component library: layout containers, field editors and display components.

Macros§

t
Catalog text checked at compile time: t!("products.title") or t!("orders.count", n = count).

Structs§

ActionMeta
Action definition generated by #[action].
AggregateRequest
One column total asked for by a grid query.
Ai
AI policy of an action or a screen, set with #[action(ai = "...")], ai = false and confirm. It applies to every way a model reaches the app: the MCP endpoint, WebMCP tools in the browser and the built in assistant.
ApiEntry
An action published as an API endpoint.
BottomNavItem
One link of the site shell’s bottom bar (SiteShell::bottom_nav): a label, a screen with a route and an optional icon above the label.
Checked
Result of reading and validating a CSV file.
Choice
The kind of a choice key: a short text the user picked, such as a tab.
ChoiceOption
One option of a #[choice] enum.
ClaimedJob
A run a worker holds a lease on.
ClientPref
A declared client preference key of kind K (Consent or Choice). Build it as a constant; an unusable name (1 to 40 ASCII letters, digits, - and _) or a lifetime under one second or over MAX_PREF_LIFETIME does not compile.
ClientPrefs
The client preference keys of an app and its consent hook, built with crate::App::client_prefs.
ColumnView
One shown column of a view: field, width set by the user and pin.
Command
A command the user can run from the palette, a menu bar or its keyboard shortcut.
Config
Merged configuration. Later sources override earlier ones.
Consent
The kind of a consent key: the user confirmed something, such as a notice.
ContextMenu
A context menu. Items run an effect in the browser or an action on the server; action items carry the action’s permission and are left out for users who may not run it.
Csp
Extra hosts for the page’s content security policy. Built with crate::App::csp:
Ctx
Request context: identity, language and services. Cheap to clone. Actions and screens may take it as an injected argument.
Cursor
Opaque position in a list, used by infinite scroll. Built by the data layer from the last row’s sort values and key. It only says where to continue; filters and permissions are applied again.
DataGrid
Data grid. Its data source is an action that takes a DataQuery and returns Page<E>.
DataGridColumn
Configures the last added column. DataGrid methods can be called from here too.
DataGridView
How a user arranged a grid: shown columns in order with widths and pins, sort and filters. Comes from the client, so the grid cleans it with its own columns before any use.
DataQuery
Query a grid sends to the server.
Date
A calendar day with no time zone: birth dates, invoice dates, holidays.
DateTime
An exact moment, always stored in UTC with millisecond precision.
DateWords
Words people type instead of a date or time, in one language: bugün, yarın, +3g in Turkish, today, tomorrow, +3d in English. Read from the zeyn.date.words.* catalog keys, each a comma separated list. English words are always understood as well.
Decimal
An exact decimal number: mantissa / 10^scale. Equal values compare equal whatever their scale (1.5 == 1.50); the scale is kept so 1.50 is shown as typed.
Dep
A dependency of an action or screen, checked when the app starts.
DiskStore
Files on the local disk under one folder: {id}.bin holds the bytes and {id}.json the metadata. Uploads are written to {id}.part and renamed when complete, so a stopped upload never shows up. Writing happens on the blocking pool, one chunk at a time.
EnvSource
Environment variables with a prefix: APP_DB__URL becomes db.url for prefix APP.
ExportColumn
One column of a typed export: the label in the user’s language and the width in pixels.
Feature
A feature: route prefix, guards, screens and menu.
Field
Typed field reference such as Product::code. A wrong field name does not compile.
FieldError
One validation error. field is empty for errors that belong to the whole model.
FieldMeta
Field definition produced at compile time.
File
A file kept by a FileStore, as a form field holds it. The id is generated by the server; the name, size and type are for display. Downloads always use what the store recorded, so a client that edits these values changes nothing but its own view.
FileChunks
The body of an upload, in chunks of at most super::UPLOAD_CHUNK bytes. An Err means the upload stopped (the client left or a limit was passed): the store must throw away what it wrote and return an error.
FileEntry
A store registered on a feature.
FileMeta
What a store records about a file. The server fills it; the store keeps it with the bytes and gives it back with FileStore::get and FileStore::meta.
FileRules
What an upload field accepts: the store it goes to, the largest file, how many files a field may hold and which types. Build it as a const and use the same value on the feature and the form, so the browser shows the limits the server checks.
Filter
Column filter. Every condition that is set must hold; unset conditions are ignored.
FixedLicense
A fixed license, for development and tests.
FooterColumn
One column of footer links.
Form
Form that edits a model. Add fields, then call submit last.
FormRow
Fields placed side by side.
I18n
Message catalogs. Built in zeyn.* messages exist in English and Turkish, and in the languages turned on with the lang-* Cargo features; apps add their own.
Identity
Who is making the request.
Import
CSV import of M rows through an action that takes Vec<Valid<M>>.
IpRange
An address range such as 10.0.0.0/8, 192.168.1.10 or 2001:db8::/32.
JobStatus
Status of one job. Errors are shown by code only; details go to the server log.
Jobs
The app’s background jobs. Inject it into actions to trigger jobs or read their status.
JsonFileSource
A JSON file of nested objects; nested keys are joined with dots. A missing file is an error.
License
A license: who holds it, until when, and which modules it opens.
Licensed
Guard: the request must have a valid license, optionally for a module.
LoadedPage
One loaded page of grid rows, type erased.
LocalDateTime
A date and wall clock time at a place, with no time zone: a clinic appointment at 10:00 stays at 10:00 for everyone.
Masking
Masking of one field, generated from #[mask(...)].
Media
An opened media file: its reader, length, content type and optional entity tag.
MediaEntry
A media source registered on a feature.
MemoryJobStore
Job runs in memory: the default store. Runs are lost when the process stops. At most capacity runs are held; when it is full the oldest failed run is dropped, and with none to drop enqueue fails.
MemoryRateStore
In memory token buckets with a cap on the number of keys, so a flood of addresses cannot exhaust memory.
MemoryStore
Files in memory, for tests and demos. Capped by total bytes; an upload that would pass the cap is refused. Unlike DiskStore it holds every file whole.
MemoryViewStore
Saved views in memory, lost on restart. For development, tests and samples.
Menu
Menu builder.
MenuGroup
Menu group.
MenuItem
Menu item.
Money
Amount of money, stored as an integer count of the smallest unit to avoid floating point errors.
NewJob
A run to put in the queue.
Node
Type erased component: a node of the screen tree.
NumberFormat
Separators used to show and read numbers in a language.
Page
One page of a list.
PerTenant
A service that is built once per tenant and reused, such as a database pool made from the tenant’s own connection string.
PrefInfo
One row of crate::App::client_prefs_table: a key as the privacy page lists it.
RateLimit
At most requests per window for each key. Bursts up to requests are allowed, then the allowance refills evenly over the window (token bucket).
Revealed
A revealed value and the record it belongs to.
Route
A route of a feature.
RowCall
An action call built on the server for one row or menu item, ready to run.
RowError
One problem in one row. row counts data rows from 1; the header is not counted.
Schedule
When a job runs and how often a failed run is tried again.
Screen
Content of a screen. Screen functions return this.
ScreenEntry
A registered screen with type erased params.
ScreenMeta
Screen definition generated by #[screen].
Search
A server search the command palette runs as the user types, registered with crate::Feature::search. The action takes the query and returns hits.
SearchHit
One result of a palette search: what it shows and the app path it opens, such as /guides/theming#density. The path is relative to the app’s base path.
Secret
A value that must never appear in logs: Debug and Display print [redacted].
Services
Registered services, looked up by type.
Shell
Chooses the page frame of a feature’s screens. The app shell is the default; call Shell::site for public pages.
SignedIn
Built in guard: the user must be signed in.
SiteFooter
Footer of the site shell.
SiteHeader
The site shell’s top bar, in slots that take any component, modeled on an app bar with logical names: start comes before the brand, center sits between the menu and the end, end closes the bar and bottom is a full width row under it, such as tabs or chips. Start and end follow the writing direction, so they swap sides in right to left languages. Each slot holds several nodes in order. Nothing is shown unless asked for.
SiteShell
Settings of the site shell. Built with Shell::site.
Slug
A readable URL part: lowercase ASCII letters and digits, words joined by -, at most Slug::MAX_LEN bytes. Turkish letters are mapped (ı, İ to i, ş to s, ğ to g, ç to c, ö to o, ü to u), other accented Latin letters lose their accent, spaces and punctuation become -, and everything else is dropped.
Sort
StaticSource
Fixed values, for defaults and tests.
StoredFile
A stored file opened for reading.
SubmitForm
Form with a submit action attached.
Tenant
The tenant a request belongs to in a multi tenant app.
TenantRequired
Built in guard: the request must belong to a tenant.
Time
A wall clock time with second precision.
TimeZone
A time zone: an IANA zone such as Europe/Istanbul with its whole history of offset and daylight saving changes, or a fixed offset such as UTC+03:00.
Toast
A toast with a tone and an optional action button, for UiCtx::notify.
ToolButton
Toolbar button being configured.
Toolbar
Screen toolbar.
Total
One computed column total.
Transition
A move from one state to another, and the permission it needs.
TransitionRecord
A transition as written to the audit log: who is in the audit entry, this says from, to and why.
TransitionRequest
What a transition button sends to its action. The record key comes from the screen on the server, never from the client.
Transitions
Buttons for the moves the user may make on one record, with an optional comment. Submitting calls the action with a TransitionRequest.
UiCtx
Context given to event handlers. Collects the effects they ask for.
Valid
A value that passed validation. Only Valid::new and deserialization create one.
ValidationErrors
All validation errors of a model.
Window
Window helpers.
Workflow
The states of a record and the allowed moves between them. Every move is checked on the server: the record must be in the move’s from state and the user must have its permission.

Enums§

Access
Who may call an action or open a screen.
Aggregate
Kind of column total.
BrowserShortcut
How a shortcut collides with the browser.
ByteRange
What a Range header asks for, for a body of a known length.
CenterOnPhone
Where the center slot of the site header goes on phones (800 px wide and less).
CsvError
Why a CSV text could not be read at all.
Currency
Currency.
DataMode
Where sorting and filtering happen.
Effect
What the client does after a user interaction.
Error
Zeyn errors.
Export
Export format.
FieldKind
How a field is shown on screen and described in the schema.
FileType
A file type an upload may have. Each type is recognized by its content, and the name’s extension must belong to the same type: a PDF renamed to .png is refused. HTML, SVG, XML and scripts are never accepted.
GuardResult
Result of a guard.
Icon
Icons.
ImportFile
A file to import: CSV text, or XLSX bytes with the xlsx feature.
JobState
What a job is doing.
LocalTimeError
Why a wall clock time could not become a moment.
MaskStyle
How a masked value is shown.
NextRun
What happens to a run after a try.
PageRequest
Which part of the list the client wants.
Paging
How a grid loads rows beyond the first batch.
Pin
Side a column is pinned to. Start is the left in left to right languages.
PrefKind
What a preference holds, for the privacy table.
Purpose
Why a preference is kept, for the privacy page and for consent.
RateKey
What a rate limit counts by.
RowStyle
Row highlight.
Rule
Field validation rule.
ScanVerdict
Whether a scanned file may be kept.
Text
Text shown to users: either a literal or a catalog key resolved in the user’s language.
Tone
Color of a badge. Tones follow the theme, so they work in light and dark mode.
Value
Type independent form of a field value. Rendering, schema and grid use this.

Constants§

BROWSER_DEFAULTS
Shortcuts a page can take over, but that people expect to do their browser’s or the text field’s job: print, save, find, address bar, history, downloads, reload, zoom, developer tools, copy and paste. Zeyn never binds them unless a command or button opts in with override_browser().
BROWSER_RESERVED
Shortcuts browsers keep for themselves and never pass to a page: new window, new tab, close tab, switch tab, quit. A command or button with one of them would never run.
COLUMN_WIDTH
Narrowest and widest column a user may set, in pixels.
DEFAULT_EXPORT_LIMIT
Most rows an export holds unless the grid sets another limit.
DEFAULT_MAX_ROWS
Rows an import takes unless set with max_rows.
DEFAULT_PAGE_SIZE
Page size used when the client sends none.
DEFAULT_PRECISION
Digits of a Decimal field without a precision rule.
DEFAULT_SCALE
Decimals of a Decimal field without a scale rule.
HARD_MAX_ROWS
Largest row limit an import may set.
JOB_LEASE
How long a worker holds a claimed run without a heartbeat. It renews the lease every third of this while the run works; a run whose worker stopped is claimed again once it has passed.
JOB_POLL
How often a worker looks for due runs in the store when nothing wakes it earlier.
MAX_BACKOFF_MS
Longest wait between two tries of a failed run.
MAX_BULK
Most rows one bulk action may cover; larger selections are refused.
MAX_COMMENT
Longest comment a transition takes, in characters.
MAX_CSV_BYTES
Largest CSV text accepted, in bytes.
MAX_EMBED_URL
Longest URL that embed_url keeps.
MAX_FIELD_FILES
Most files one field may hold, whatever the rules say.
MAX_FILE_NAME
Longest file name kept, in characters. Longer names are cut.
MAX_FILTERS
Most filters one query may carry; the rest are dropped.
MAX_FILTER_CHOICES
Most choices one any_of condition may list; the rest are dropped.
MAX_FILTER_TEXT
Longest filter text in characters; longer conditions are ignored.
MAX_JOB_PAYLOAD
Longest payload of a queued run, in bytes. Payloads carry ids and small JSON, not documents.
MAX_MEDIA_ID
Longest media id, in bytes.
MAX_PAGE_SIZE
Largest number of rows one request may return, whatever the client asks for.
MAX_PINNED
Most columns pinned to one side.
MAX_POSITION_SECONDS
Longest saved play position, in seconds (about 115 days). Longer values are refused.
MAX_PRECISION
Most significant digits a Decimal holds, the precision of NUMERIC(38, s) and Oracle NUMBER.
MAX_PREF_LIFETIME
Longest lifetime of a client preference: 400 days, the longest browsers keep a cookie.
MAX_PUBLIC_MEDIA_CACHE
Longest cache time of a public media source, in seconds (one year).
MAX_SCALE
Most decimals a Decimal holds.
MAX_SCREEN_CACHE
Longest cache = N a screen may ask for: one day.
MAX_SEARCH_HITS
Most results one palette search shows, over all features.
MAX_SEARCH_QUERY
Longest palette search query, in characters. Longer queries are cut.
MAX_SEGMENT
Longest path segment value read or written, in bytes.
MAX_SORT
Most sort keys one query may carry.
MAX_TOASTS
Most toasts the runtime shows at once; older ones make room for new ones.
MAX_UPLOAD_BYTES
Largest file any upload may have, whatever the rules say: 1 GiB.
MEDIA_CHUNK
Bytes read from a media reader at a time.
MEMORY_JOB_CAPACITY
Runs a MemoryJobStore holds unless built with MemoryJobStore::with_capacity.
PALETTE_SHORTCUT
The default shortcut of the command palette. It is free in every common browser; apps can choose another with App::palette_shortcut.
SNIFF_BYTES
Bytes read from the start of an upload to learn its type.
TRACKING_PARAMS
Query parameters that only track the visitor. embed_url removes them, and every parameter whose name starts with utm_.
UPLOAD_CHUNK
Bytes passed to a store at a time.
VIRTUAL_LIVE_ROWS
Rows of a virtual grid’s first block rendered live in the page (enough for a tall screen plus the overscan); the rest of the block waits in a <template> until it scrolls into view.
VIRTUAL_WIDE_COLUMNS
Fewest columns (with the selection, detail and row action columns) for which a virtual grid sends its whole first block in the <template>, so the browser styles and lays out only the columns the runtime keeps in view. Matches COLV_MIN of the browser runtime (assets/zeyn/grid-cells.js), where column windowing starts.

Traits§

Action
A server side action. Generated by #[action], never written by hand.
ApiInput
Types an API action can take as input.
ApiOutput
Types an API action can return inside Result.
ApiResult
What an API action returns: zeyn::Result<T> with an API friendly T.
BulkAction
Actions that take the keys of selected rows: their input is Vec<K>, where K is the type of the key field given to bulk_action.
CellRenderer
Draws the content of a grid cell from the column’s typed value. The extension point for app specific cells; closures Fn(&T, &Render) -> String are renderers too.
ChoiceType
Enums made with #[choice]. DataGrid badges work only on them.
Component
Anything that can be placed on a screen. This is the extension point for third party components.
ConfigSource
Where configuration comes from: environment, a file, a database, a vault, a license server.
DataGridViewStore
Where saved grid views live, one per user and grid. Register one with App::datagrid_views.
Entity
A model stored in a database table. Generated by #[entity].
FieldType
Types that can be model fields.
FileScanner
Checks an uploaded file before it is accepted, such as a virus scanner. Registered with Feature::scan_files. A refused file, or a scanner that fails, is deleted and the upload answers 422.
FileStore
Where uploaded files are kept. Registered with Feature::files.
FormAction
Actions that can submit a form of M: their input must be Valid<M>.
FormSource
A component that saves data through an action. Implemented by forms with submit.
GridSource
A component that loads rows through an action. Implemented by DataGrid.
Guard
A check that runs on the server before any screen of a feature is opened and before any of its grids or forms is called. Plain functions fn(&Ctx) -> GuardResult are guards.
ImportSource
An import component on a screen, as the server sees it.
Inject
Types that can be injected into actions and screens: Ctx and registered services.
IntoScreen
What a screen function may return.
IsBool
Yes/no column types, for check_icon().
IsMoment
Moment column types, for relative_time().
JobStore
Where job runs are stored. A run is claimed with a lease: until the lease ends no other worker gets it, and a worker that stops without finishing leaves a run that is claimed again once the lease has passed. MemoryJobStore is the default; SqlJobStore (features postgres, oracle) keeps runs across restarts and shares them between servers.
LicenseSource
Where licenses come from: a file, a license server, a vault, a database. Called with the request’s tenant in multi tenant apps.
MediaReader
What a media response is read from. Any Read + Seek works, such as std::fs::File.
MediaSource
Where an app keeps its media: films, songs, recordings, captions. Registered with Feature::media under a permission.
Model
Validated data with typed fields. Generated by #[model] or #[entity], never written by hand.
Outcome
Action outputs that can report failure to a form or grid.
Params
Screen params. Implemented by #[params]; screens without params use ().
PathValue
A params field type that can be a path segment of a route, such as id in /orders/{id}. A segment only parses in the one form the framework writes it in (7, not +7 or 007), so each record has one address.
RateStore
Counters behind a rate limit. The built in one keeps them in memory, which is right for a single server; several servers behind a load balancer need a shared store such as RedisStore (Cargo feature redis).
ScreenDef
A screen. Implemented by #[screen], never written by hand.
Service
Marks a type as an injectable service. Register it with App::service.
SupportsMinMax
Types that accept the min and max rules.
SupportsMinMaxTotal
Column types that accept min() and max() totals in a grid.
SupportsRequired
Types that accept the required rule.
SupportsScale
Types that accept the scale and precision rules.
SupportsSum
Column types that accept sum() in a grid.
SupportsText
Types that accept the text rules min_len, max_len and email.
UploadValue
Field types an upload control can fill.
VecItem
Item types a Vec<T> field can hold: line models (#[model], #[entity]), edited as a lines table, and #[choice] enums, edited with a multi select. Vec<i64> holds ids for Form::lookup_many.
WorkflowState
States are #[choice] enums.

Functions§

browser_shortcut
Whether a normalized shortcut (see normalize_shortcut) belongs to the browser.
can_unmask
Whether the identity behind ctx may see the raw value of a masked field. Never for calls made by AI agents (MCP, WebMCP, the assistant): masked values do not go to models, whatever the user may see.
check_csv
Reads a CSV file and validates every row as a form of M would, in the user’s language and time zone. Columns are matched by field name or label, in any case.
check_file
Reads a CSV or XLSX file and validates every row as check_csv does. XLSX cells keep their types: numbers, dates and booleans are read as such, whatever the user’s locale.
clean_file_name
A file name safe to keep and show: the part after the last / or \, without control characters, cut to MAX_FILE_NAME characters, never empty, never starting with a dot.
client_ip
The client’s address: the connection’s peer, or, when the peer is a trusted proxy, the last address in X-Forwarded-For that is not a trusted proxy.
embed_url
The canonical form of an address to embed, or None when it cannot be embedded.
error_report
Error report as CSV (row;field;message), safe to open in a spreadsheet.
masked_text
The text a masked field is shown with. Unmasked fields come back unchanged.
media_type
Content type for a file name, by its extension; application/octet-stream when unknown.
model_schema
JSON Schema of an object with the model’s fields.
normalize_shortcut
Reads a shortcut such as "ctrl+shift+p" into the form aria-keyshortcuts uses: Control+Shift+P. Modifiers come in the order Control, Alt, Shift, Meta. None when it cannot be read.
parse_csv
Reads CSV text: a UTF-8 byte order mark is dropped, the separator (,, ; or tab) is taken from the header line, values may be quoted with " (doubled inside), quoted values may hold separators and line breaks, and both \r\n and \n end a row. Empty lines are skipped.
parse_ranges
Parses a list of ranges; invalid entries are reported so a typo never opens a door silently.
position_cursor
Cursor for a row position in an in memory list.
range_presets
Ranges offered next to a date range picker, worked out from today in the user’s time zone: (key, from, to) with keys today, yesterday, last_7_days, this_month, last_month, this_year. Labels are the zeyn.ui.date.presets.{key} catalog texts.
reveal_in
The raw value of a masked field of model, for an audited reveal.
route_has_segments
Whether a route has path segments. Usable in constant checks.
screen_url
URL of a screen at path (its route with the feature prefix) with these params: path segments filled from the params fields of the same name, the other fields in the JSON params query. Fields that are null (an empty Option) are left out of the query, so the address stays canonical. None when a segment’s field is missing or not a number or a usable string.
total
Computes one total over a column’s values. Nulls are skipped. None when the op does not fit the values (a sum of text, or money in different currencies). Money averages round half away from zero to the smallest unit.
valid_file_id
Whether a file id has the shape the server generates: 32 lower case hex digits.
valid_media_id
Whether a media id or source name has a safe shape: 1 to 128 ASCII letters, digits, -, _ and ., not starting with a dot and without ... Ids that fail are answered with 404 before any source sees them.

Type Aliases§

BoxFuture
Boxed future returned by generated call and build functions.
Result
Result type of Zeyn actions.

Attribute Macros§

action
Defines a server side action. Access must be declared.
choice
Defines a field type with a fixed set of options (a select list). Variants may take #[label("...")].
entity
Defines a model stored in a database table. Needs table = "..." and exactly one #[key] field.
model
Defines validated data that is not tied to a table: form input, filters, wizard steps, report rows.
params
Marks a struct or enum as screen params.
screen
Defines a screen. The first argument is its params; a screen without params takes none or _: ().