flipper-rpc 0.9.5

Rust bindings and serial transport helpers for the Flipper Zero RPC protocol.
1
2
3
4
5
6
7
8
9
10
11
12
//! Helper functions for dealing with FS protocols

use crate::error::Result;
use std::ffi::OsStr;

#[inline(always)]
/// Converts an &OsStr into a regular &str with a standard error
pub fn os_str_to_str(path: &OsStr) -> Result<&str> {
    path.to_str().ok_or_else(|| {
        std::io::Error::new(std::io::ErrorKind::InvalidData, "Path is not UTF-8").into()
    })
}