doc_path.rs 270 B

123456789101112
  1. #[derive(Debug)]
  2. pub struct DocPath(pub String);
  3. impl DocPath {
  4. pub fn parse(s: String) -> Result<DocPath, String> {
  5. if s.trim().is_empty() {
  6. return Err(format!("Doc path can not be empty or whitespace"));
  7. }
  8. Ok(Self(s))
  9. }
  10. }