Skip to main content

format_import_from

Function format_import_from 

Source
pub fn format_import_from(level: u32, module: Option<&str>) -> Cow<'_, str>
Expand description

Format the module reference name for a relative import.

ยงExamples


assert_eq!(format_import_from(0, None), "".to_string());
assert_eq!(format_import_from(1, None), ".".to_string());
assert_eq!(format_import_from(1, Some("foo")), ".foo".to_string());