1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
use std::{error::Error, path::Path}; pub trait FromPath: Sized { type Error: Error; fn from_path(path: impl AsRef<Path>) -> Result<Self, Self::Error>; } // impl FromPath for ItemMod { // type Error = io::Error; // // fn from_path(path: impl AsRef<Path>) -> Result<Self, Self::Error> { // let item = // for entry in read_dir(path)? { // let entry = entry?; // // } // Ok(()) // } // }