rt: add error documentation for runtime::Builder (#8297)

This commit is contained in:
Motoyuki Kimura
2026-07-30 12:29:09 +02:00
committed by GitHub
parent dc48a05132
commit adc2ae7af2
3 changed files with 20 additions and 0 deletions
+10
View File
@@ -1069,6 +1069,11 @@ impl Builder {
/// });
/// # }
/// ```
///
/// # Errors
///
/// Returns an error if the I/O driver or other OS resources required by the
/// runtime cannot be initialized.
pub fn build(&mut self) -> io::Result<Runtime> {
match &self.kind {
Kind::CurrentThread => self.build_current_thread_runtime(),
@@ -1100,6 +1105,11 @@ impl Builder {
/// println!("Hello from the Tokio runtime");
/// });
/// ```
///
/// # Errors
///
/// Returns an error if the I/O driver or other OS resources required by the
/// runtime cannot be initialized.
pub fn build_local(&mut self, _options: LocalOptions) -> io::Result<LocalRuntime> {
match &self.kind {
Kind::CurrentThread => self.build_current_thread_local_runtime(),
@@ -86,6 +86,11 @@ impl LocalRuntime {
/// // Use the runtime...
/// ```
///
/// # Errors
///
/// Returns an error if the I/O driver or other OS resources required by the
/// runtime cannot be initialized.
///
/// [mod]: crate::runtime
/// [runtime builder]: crate::runtime::Builder
pub fn new() -> std::io::Result<LocalRuntime> {
+5
View File
@@ -165,6 +165,11 @@ impl Runtime {
/// // Use the runtime...
/// ```
///
/// # Errors
///
/// Returns an error if the I/O driver or other OS resources required by the
/// runtime cannot be initialized.
///
/// [mod]: index.html
/// [main]: ../attr.main.html
/// [threaded scheduler]: index.html#threaded-scheduler