Guest User

Untitled

a guest
Jun 19th, 2018
90
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.48 KB | None | 0 0
  1. pub struct RelativePath {
  2. pub segments: Vec<String>
  3. }
  4. pub struct AbsolutePath {
  5. pub segments: Vec<PathSegment>
  6. }
  7.  
  8. #[derive(Clone, Debug, PartialEq)]
  9. enum PathSegment {
  10. Placeholder(String),
  11. Literal(String)
  12. }
  13.  
  14. impl AbsolutePath {
  15. pub fn append(&mut self, mut path: RelativePath) {
  16. // &mut path.segments
  17. let &mut lits = path.segments.iter_mut().map(|s| PathSegment::Literal(s.to_string())).collect();
  18. self.segments.append(lits);
  19. }
  20. }
  21.  
  22. fn main() {}
Add Comment
Please, Sign In to add comment