Expand description
snailx provides a simple, zero-allocation interface for iterating over program arguments.
This crate exposes lightweight, zero-copy iterators over program arguments:
Args::newyieldsCStr<’static>MappedArgs::utf8yields&'static str- if the
assume_valid_strfeature is enabled, all arguments are assumed to be valid UTF-8 - if the
assume_valid_strfeature is disabled, invalid UTF-8 arguments are skipped
- if the
direct::argc_argvreturns the raw(argc, argv)MappedArgs::newlets you map each*const u8argument pointer into a custom type;Nonevalues are skippedMappedArgs::osstr(with thestdfeature) yields&'static std::ffi::OsStr
no_std by default; enable the std feature for OsStr support.
Targets Unix-like systems and macOS.
Modules§
- direct
- Direct, platform-specific access to
argcandargv. Most users should prefer the higher-level iterators in the crate root.
Structs§
- Args
- An iterator over program arguments as
CStr<’static>. - CStr
- A minimal CStr implementation for use in place of
core::ffi::CStr(unstable before 1.64) andstd::ffi::CStr(requiresstd). - Mapped
Args - An iterator that maps each argument using a user-provided function. If the mapping returns
None, that argument is skipped.
Functions§
- args_
slice - Returns a slice of
CStr<’static>.