Skip to main content

Module cow_and_paths

Module cow_and_paths 

Source
Expand description

Cow, PathBuf, OsString, and string collection conversions.

  • Cow<'_, [T]> — owned copy of R native vectors
  • Cow<'_, str> — owned copy of R character scalars
  • PathBuf / OsString — from STRSXP via String intermediary
  • HashSet<String> / BTreeSet<String> — string set conversions

§Tradeoff

These TryFromSexp impls reject mismatched SEXPTYPEs — there is no looser coercion path for Cow / PathBuf / OsString. Raw Cow conversions own their data and may outlive the source. super::TryFromRoot supplies the borrowing path with a root-bound lifetime; generated wrappers use it for explicit Cow parameters.

Re-exports§

use std::borrow::Cow; 🔒
use std::collections::BTreeSet; 🔒
use std::collections::HashSet; 🔒
use std::ffi::OsString; 🔒
use std::path::PathBuf; 🔒
use crate::SEXP; 🔒
use crate::from_r::SexpError; 🔒
use crate::from_r::SexpTypeError; 🔒
use crate::from_r::TryFromSexp; 🔒
use crate::from_r::map_strsxp_with; 🔒
use crate::from_r::try_charsxp_to_str; 🔒

Macros§

impl_set_string_try_from_sexp 🔒
impl_string_wrapper_try_from_sexp 🔒
Generate TryFromSexp impls for types that are From<String> (scalar, Option, Vec, Vec<Option>). Used for PathBuf and OsString which delegate to String conversion.