Skip to content

Commit 959d981

Browse files
committed
add document for function
1 parent ef3af14 commit 959d981

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

runtime/src/precompiles/mod.rs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -233,6 +233,14 @@ fn dispatch(
233233
}
234234
}
235235

236+
/// Retrieves a single u8 value from the given data slice at the specified index.
237+
///
238+
/// # Args
239+
/// * `data`: The slice of bytes from which to retrieve the u8 value.
240+
/// * `index`: The index within the `data` slice where the u8 value is located.
241+
///
242+
/// # Returns
243+
/// A `Result` containing the u8 value at the specified index if successful, or a `PrecompileFailure` if the index is out of range.
236244
pub fn get_single_u8(data: &[u8], index: usize) -> Result<u8, PrecompileFailure> {
237245
if let Some(result) = data.get(index) {
238246
Ok(*result)

0 commit comments

Comments
 (0)