Adapter
- Kind
- A server-side library that implements the Inertia protocol.
- Behavior
- Decides whether a request gets an HTML document or JSON, builds the page object, and applies the protocol's rules for redirects and versions.
- Boundary
- Not the Inertia client. The client runs in the browser; the adapter runs on the server.
- Instance
inertia-laravel-rustfor Rust. The Laravel adapter is the reference implementation.
Defined in Introduction. Sources: Inertia.js v3 documentation, The Protocol; inertiajs/inertia-laravel-rust @3ccc126a24c8fb5bddb140876a1825292c0d216c.
Crate
- Kind
- Rust's compilation unit: the smallest amount of code the compiler considers at a time.
- Parts
- Two forms: a binary crate, which is a program, and a library crate, which other code depends on.
- Behavior
- Compiles as one unit.
- Boundary
- Not a package. A package is a bundle of one or more crates that Cargo builds and shares.
- Instance
inertia-laravel-rustis a library crate that your code imports asinertia.- Analogue
- A Composer package, loosely. This comparison is the author's.
Defined in Introduction. Sources: The Rust Programming Language, ch. 7.1, Packages and Crates.
Handler
- Kind
- A function that a route calls.
- Behavior
- Returns the response for one request.
- Boundary
- Not middleware. Middleware runs around a handler; Chapter 2 shares props from one.
- Instance
homein the crate's quick start, which returnsinertia.render("Home", ...).- Analogue
- A Laravel controller method. This comparison is the author's.
Defined in Introduction. Sources: inertiajs/inertia-laravel-rust @3ccc126a24c8fb5bddb140876a1825292c0d216c.
Inertia
- Kind
- A client-side routing library, and the protocol it speaks with a server.
- Parts
- Two parts. The client library runs in the browser. An adapter implements the protocol on the server.
- Behavior
- Answers a page visit with the name of a page component and its props, in place of a server-rendered view.
- Boundary
- Not a JSON API that you design. The server keeps its routes, handlers and middleware, and the protocol fixes the shape of the response.
- Instance
- A visit to
/invoices/7carryingX-Inertia: truegets back a page object whosecomponentisInvoices/Show. - Analogue
- Returning a Blade view from a controller, except the view is a JavaScript component and its data arrives as JSON. This comparison is the author's.
Defined in Introduction. Sources: Inertia.js v3 documentation, How It Works; Inertia.js v3 documentation, The Protocol.
Page component
- Kind
- A React, Vue or Svelte component.
- Behavior
- Renders one whole page from the props it is given.
- Boundary
- Not a layout or a partial. A page object names exactly one page component.
- Instance
Invoices/Show.- Analogue
- A Blade view file, except it runs in the browser. This comparison is the author's.
Defined in Introduction. Sources: Inertia.js v3 documentation, How It Works.
Page object
- Kind
- A JSON object.
- Parts
- Four required fields:
component,props,urlandversion. Other fields appear only when they apply. - Behavior
- Tells the client which page component to show and what data to give it.
- Boundary
- Not an API resource. It describes a page, not a record.
- Instance
{"component":"Invoices/Show","props":{"invoiceId":7},"url":"/invoices/7","version":"1"}, trimmed to the required fields.
Defined in Introduction. Sources: Inertia.js v3 documentation, The Protocol; inertiajs/inertia-laravel-rust @3ccc126a24c8fb5bddb140876a1825292c0d216c.
Props
- Kind
- A JSON object, held in the page object's
propsfield. - Behavior
- Carries data from a handler to a page component.
- Boundary
- Not component state. Props come from the server with each visit.
- Instance
{"invoiceId":7}.- Analogue
- The array passed as the second argument to
view()in Laravel. This comparison is the author's.
Defined in Introduction. Sources: Inertia.js v3 documentation, How It Works; Inertia.js v3 documentation, The Protocol.
Struct
- Kind
- A Rust type, defined with the keyword
struct. - Parts
- Named fields, each with its own type. The definition fixes how many.
- Behavior
- Groups related values under one name.
- Boundary
- Not a tuple. A tuple's values are told apart by position; a struct's values are named.
- Instance
Invoice { id: 7, total_cents: 1200 }.- Analogue
- A PHP class with typed public properties and no methods. This comparison is the author's.
Defined in Introduction. Sources: The Rust Programming Language, ch. 5.1, Defining and Instantiating Structs.