refactor: optimize directory module truncation from beginning
refactor: optimize directory module truncation from beginning

* Optimize truncation from the beginning

* rustfmt: formatted src/modules.rs

Afulton11/contrail