Skip to main content

is_path_reference

Function is_path_reference 

Source
pub fn is_path_reference(reference: &str) -> bool
Expand description

Whether reference, an @ token without its @, looks like a path by its shape alone: it holds a /, or ends in a dot and one to four letters or digits. attachments reports such a token as missing when no file is there; any other token (a mention, an address, or a file with no extension) is attached only when its file is there, and is otherwise left as text.

use rig_tools::attach::is_path_reference;

assert!(is_path_reference("src/main.rs"));
assert!(is_path_reference("notes.md"));
assert!(!is_path_reference("reviewer"));