@@ -640,8 +640,11 @@ pub struct InputTrie {
640
640
}
641
641
642
642
impl InputTrie {
643
- /// Constructs a new inputs trie with the given guest inputs directory.
644
- pub fn new ( guest_inputs_dir : & ' static str ) -> Self {
643
+ /// Constructs a new inputs trie with a guest inputs directory.
644
+ ///
645
+ /// Inputs with a host path will be mapped to a guest path relative to the
646
+ /// guest inputs directory.
647
+ pub fn new_with_guest_dir ( guest_inputs_dir : & ' static str ) -> Self {
645
648
Self {
646
649
guest_inputs_dir : Some ( guest_inputs_dir) ,
647
650
..Default :: default ( )
@@ -650,6 +653,11 @@ impl InputTrie {
650
653
651
654
/// Inserts a new input into the trie.
652
655
///
656
+ /// The `path` parameter is a `File` or `Directory` value (as a string) to
657
+ /// treat as an input.
658
+ ///
659
+ /// It may be either a local or remote path.
660
+ ///
653
661
/// Returns `Ok(Some(_))` if an input was added.
654
662
///
655
663
/// Returns `Ok(None)` if the provided path was already a guest input path
@@ -939,7 +947,7 @@ mod test {
939
947
#[ cfg( unix) ]
940
948
#[ test]
941
949
fn non_empty_trie_unix ( ) {
942
- let mut trie = InputTrie :: new ( "/inputs" ) ;
950
+ let mut trie = InputTrie :: new_with_guest_dir ( "/inputs" ) ;
943
951
trie. insert ( InputKind :: Directory , "/" ) . unwrap ( ) . unwrap ( ) ;
944
952
trie. insert ( InputKind :: File , "/foo/bar/foo.txt" )
945
953
. unwrap ( )
@@ -1029,7 +1037,7 @@ mod test {
1029
1037
#[ cfg( windows) ]
1030
1038
#[ test]
1031
1039
fn non_empty_trie_windows ( ) {
1032
- let mut trie = InputTrie :: new ( "/inputs" ) ;
1040
+ let mut trie = InputTrie :: new_with_guest_dir ( "/inputs" ) ;
1033
1041
trie. insert ( InputKind :: Directory , "C:\\ " ) . unwrap ( ) . unwrap ( ) ;
1034
1042
trie. insert ( InputKind :: File , "C:\\ foo\\ bar\\ foo.txt" )
1035
1043
. unwrap ( )
0 commit comments