📝 fix async alias examples

This commit is contained in:
Nanaloveyuki
2026-06-14 00:09:42 +08:00
parent e27f5680e6
commit ab45a9e4e3
2 changed files with 10 additions and 8 deletions
+5 -4
View File
@@ -2,8 +2,8 @@
name: application-async-logger
group: api
category: facade
update-time: 20260613
description: Application-facing alias for the runtime-sink async logger surface.
update-time: 20260614
description: Application-facing alias for the runtime-sink async logger surface, preserving the same async calling semantics as AsyncLogger.
key-word:
- application
- async
@@ -31,6 +31,7 @@ Detailed rules explaining key parameters and behaviors
- This alias does not introduce a new runtime type or wrapper layer.
- It preserves the same async lifecycle helpers such as `run()`, `shutdown()`, `pending_count()`, and `state()`.
- Because this is only an alias, methods that are async on `AsyncLogger[@bitlogger.RuntimeSink]` remain async here as well.
- The alias exists to give application boot code a clearer public type name for the standard runtime-sink async logger.
- Builders such as `build_application_async_logger(...)` and `parse_and_build_application_async_logger(...)` return this alias.
@@ -53,12 +54,12 @@ In this example, the application alias keeps the same underlying async logger be
When top-level boot code or services should expose an application-oriented async logger type:
```moonbit
fn start_async(logger : ApplicationAsyncLogger) -> Unit {
async fn start_async(logger : ApplicationAsyncLogger) -> Unit {
logger.run()
}
```
In this example, callers see the app-facing alias instead of the more explicit generic async logger spelling.
In this example, callers see the app-facing alias instead of the more explicit generic async logger spelling, while `run()` keeps its async calling contract.
### Error Case
+5 -4
View File
@@ -2,8 +2,8 @@
name: application-text-async-logger
group: api
category: facade
update-time: 20260613
description: Application-facing alias for the text-console async logger surface.
update-time: 20260614
description: Application-facing alias for the text-console async logger surface, preserving the same async calling semantics as AsyncLogger.
key-word:
- application
- async
@@ -31,6 +31,7 @@ Detailed rules explaining key parameters and behaviors
- This alias does not introduce a new runtime type or wrapper layer.
- It preserves the same async lifecycle helpers as other async logger aliases.
- Because this is only an alias, methods that are async on `AsyncLogger[@bitlogger.FormattedConsoleSink]` remain async here as well.
- The alias exists to give application code a clearer public name when it wants the concrete text-console sink shape explicitly.
- `build_application_text_async_logger(...)` returns this alias.
@@ -53,12 +54,12 @@ In this example, the application alias keeps the same underlying async logger be
When caller code should know it is working with the text-console variant:
```moonbit
fn start_text_async(logger : ApplicationTextAsyncLogger) -> Unit {
async fn start_text_async(logger : ApplicationTextAsyncLogger) -> Unit {
logger.run()
}
```
In this example, the app-facing alias communicates the concrete text-console async shape directly.
In this example, the app-facing alias communicates the concrete text-console async shape directly, while `run()` keeps its async calling contract.
### Error Case