MCPcopy Create free account
hub / github.com/atomicdotdev/atomic / encode_invalid_units

Function encode_invalid_units

atomic-cli/src/agent_error.rs:293–305  ·  view source on GitHub ↗
(arg: &OsStr)

Source from the content-addressed store, hash-verified

291/// Preserve the exact platform units of a non-UTF-8 argv entry.
292#[cfg(unix)]
293fn encode_invalid_units(arg: &OsStr) -> Option<String> {
294 use std::fmt::Write as _;
295 use std::os::unix::ffi::OsStrExt as _;
296
297 if arg.to_str().is_some() {
298 return None;
299 }
300 let mut encoded = String::from("unix-hex:");
301 for byte in arg.as_bytes() {
302 let _ = write!(encoded, "{byte:02x}");
303 }
304 Some(encoded)
305}
306
307#[cfg(windows)]
308fn encode_invalid_units(arg: &OsStr) -> Option<String> {

Callers

nothing calls this directly

Calls 1

as_bytesMethod · 0.45

Tested by

no test coverage detected