INNER CODE UNIT · Rust
path_to_cstring
rusqlite/rusqlite · src/lib.rs:345
fn path_to_cstring(p: &Path) -> Result<CString> {
cfg_select! {
unix => {
use std::os::unix::ffi::OsStrExt as _;
Ok(CString::new(p.as_os_str().as_bytes())?)
}
_ => {
let s = p.to_str().ok_or_else(|| Error::InvalidPath(p.to_owned()))?;
Ok(CString::new(s)?)
}
}
}
/// Shorthand for `Main` database.
pub const MAIN_DB: &CStr = c"main";
/// Shorthand for default name.
pub const DEFAULT_NAME: Option<&'static str> = None;
/// Shorthand for `Temp` database.