日本語

Route and Link

Route<P, Q> is a page served at a path, with path parameters P and search parameters Q. Link<S> is a link to that page.

Route

Declare one in routes! with its handler, and use the same value in the links to the page.

ItemSummary
routes!Declares the pages of an application and the function that serves them.
linkA link to this page, which has no parameters.
link_withA link to this page with the arguments args.
urlThe URL of this page with the arguments args, written on the server.
pathThe path as axum matches it, with each parameter still written {name}.
BaseThe path prefix an application is served under, such as /app behind a proxy.
Base::newThe prefix path, which starts with / and does not end with one.
Base::ROOTNo prefix: the application is served at the root of its host.
Base::as_strThe prefix as text, empty for Base::ROOT.
ItemSummary
ParamsThe parameters of a Route: (), one Segment, or a tuple of two to six.
SegmentA type one {name} segment of a Route holds.
derive(Segment)Implements hypersig::Segment for an enum whose variants have no fields.
SearchThe search parameters of a Route: (), or a struct with #[derive(Signals, Search)].
SearchValueA Search field type: a SearchScalar, or an Option or Vec of one.
SearchScalarA type that one value of the query string holds.
derive(Search)Checks that each field of a struct can be written into a query string.
RestThe rest of a path, from a {*name} segment at its end, which may hold /.
ExtendsParameters that start with the parameters P of a parent Route.
LinkA link to a Route, for El::href on the page whose signals are S.
Link::navigateA statement that loads the linked page, as following the link would.
Link::push_urlA statement that shows the linked URL in the address bar as a new history entry.
Link::replace_urlA statement that shows the linked URL in the address bar in place of the current one.
UrlThe URL of a page, written on the server by Route::url.
SafeUrlA URL whose scheme cannot run a script: http:, https:, mailto:, or none at all, as in /logo.png, #top, ?page=2, or //cdn.example/a.js.
SafeUrl::parseReads a URL from outside the program, such as one a visitor typed.
UnsafeUrlText that SafeUrl::parse refused, with the rule it broke.