wasi-common 0.21.0

WASI implementation in Rust
Documentation
1
2
3
4
5
6
7
8
9
10
11
use crate::old::snapshot_0::wasi::WasiResult;
use std::str;

/// Creates not-owned WASI path from byte slice.
///
/// NB WASI spec requires bytes to be valid UTF-8. Otherwise,
/// `__WASI_ERRNO_ILSEQ` error is returned.
pub(crate) fn path_from_slice<'a>(s: &'a [u8]) -> WasiResult<&'a str> {
    let s = str::from_utf8(s)?;
    Ok(s)
}