Перейти к основному содержимому
Эта страница ещё не переведена

Ниже показан английский оригинал.

AppId

AppId is the identifier of the service at the root of the document, a URI parsed when it is built.

AsyncAPI requires the id to be a URI. AppId checks the part a URI scheme must have: a letter, then letters, digits, +, - or ., then a colon. What follows the colon is the scheme's business. A bare title fails with AppIdError::NoScheme, and a malformed scheme with MalformedScheme. AppInfo::id sets it, and only a parsed AppId fits there. An id from the deployment's configuration therefore fails where the app is built, never in a published document. The example runs with cargo test --example asyncapi_info --no-default-features --features asyncapi.

Example​

/// The id comes from the deployment's configuration, so a value that is not a URI stops the
/// build of the app.
fn app(id: &str) -> Result<impl App, AppIdError> {
let id: AppId = id.parse()?;
Ok(RustStream::new(info().id(id)))
}