Function norad::user_name_to_file_name
source · pub fn user_name_to_file_name(
name: impl AsRef<str>,
prefix: &str,
suffix: &str,
accept_path: impl FnMut(&str) -> bool
) -> PathBuf
Expand description
Given a name
, return an appropriate file name.
This file name is computed via the Common User Name to File Name Algorithm defined in the UFO spec.
the prefix
and suffix
fields will be added to the start and end of the
generated path; for instance the suffix
might be a file extension.
The accept_path
closure is a way of indicating whether or not a candidate
path should be used. In general, this involves ensuring that the candidate path
does not already exist. Paths are always lowercased, and case insensitive.
§Panics
Panics if a case-insensitive file name clash was detected and no unique value could be created after 99 numbering attempts.