Skip to main content

encode_name

Function encode_name 

Source
pub fn encode_name(name: &str) -> Cow<'_, str>
Expand description

Map one path component to the form SMB2 accepts on the wire.

Takes a single name, never a path: a / is left alone here and a \ becomes U+F026, so handing this a path would turn its separators into name characters. Use encode_path for anything with separators in it.

A name with nothing to map is returned borrowed and unchanged.

assert_eq!(encode_name("report.pdf"), "report.pdf");
assert_eq!(encode_name("who?"), "who\u{F025}");
assert_eq!(encode_name("trailing "), "trailing\u{F028}");