Skip to content

Commit 10c81b5

Browse files
committed
docs: add # Errors sections and fix doc_markdown warnings
- Add backticks to ErrorPayload in error.rs doc (clippy doc_markdown) - Inline format args in to_error_payload() (clippy uninlined_format_args) - Add # Errors documentation to Decode and Encode trait methods (clippy missing_errors_doc) - Add # Errors documentation to Handle::join() (clippy missing_errors_doc)
1 parent 1defb22 commit 10c81b5

2 files changed

Lines changed: 22 additions & 0 deletions

File tree

crates/traits/src/codec.rs

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,9 +110,19 @@ impl CodecConfig for DefaultCodecConfig {
110110
/// Trait for decoding bytes into a type with configuration.
111111
pub trait Decode: Sized {
112112
/// Decode from bytes using the given configuration.
113+
///
114+
/// # Errors
115+
///
116+
/// Returns [`CodecError`] if decoding fails due to invalid data,
117+
/// size limits exceeded, or other configuration violations.
113118
fn decode<C: CodecConfig>(bytes: &[u8], config: &C) -> Result<Self, CodecError>;
114119

115120
/// Decode from Bytes using the given configuration.
121+
///
122+
/// # Errors
123+
///
124+
/// Returns [`CodecError`] if decoding fails due to invalid data,
125+
/// size limits exceeded, or other configuration violations.
116126
fn decode_bytes<C: CodecConfig>(bytes: &Bytes, config: &C) -> Result<Self, CodecError> {
117127
Self::decode(bytes.as_ref(), config)
118128
}
@@ -121,9 +131,17 @@ pub trait Decode: Sized {
121131
/// Trait for encoding a type into bytes.
122132
pub trait Encode {
123133
/// Encode into bytes.
134+
///
135+
/// # Errors
136+
///
137+
/// Returns [`CodecError`] if encoding fails.
124138
fn encode(&self) -> Result<Bytes, CodecError>;
125139

126140
/// Encode into a `Vec<u8>`.
141+
///
142+
/// # Errors
143+
///
144+
/// Returns [`CodecError`] if encoding fails.
127145
fn encode_vec(&self) -> Result<Vec<u8>, CodecError> {
128146
self.encode().map(|b| b.to_vec())
129147
}

crates/traits/src/runtime.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,10 @@ impl<T> Handle<T> {
2222
}
2323

2424
/// Wait for the task to complete.
25+
///
26+
/// # Errors
27+
///
28+
/// Returns [`JoinError`] if the task was cancelled or panicked.
2529
pub async fn join(self) -> Result<T, JoinError> {
2630
self.inner.await.map_err(JoinError)
2731
}

0 commit comments

Comments
 (0)