Skip to main content

rl_lang/docs/entries/stdlib/path/
mod.rs

1use crate::docs::entry::{FnEntry, StdEntry};
2
3pub static PATH: StdEntry = StdEntry {
4    name: "path",
5    description: "functions for working with filesystem paths",
6    functions: FUNCTIONS,
7    since: None,
8    unstable: false,
9};
10
11static FUNCTIONS: &[&FnEntry] = &[
12    &PATH_EXISTS,
13    &PATH_EXTENSION,
14    &PATH_FILENAME,
15    &PATH_IS_DIR,
16    &PATH_IS_FILE,
17    &PATH_JOIN,
18    &PATH_PARENT,
19    &PATH_POP,
20    &PATH_PUSH,
21    &PATH_SET_EXTENSION,
22    &PATH_STEM,
23];
24
25static PATH_EXISTS: FnEntry = FnEntry {
26    signature: "path_exists(path)",
27    description: "returns true if the path exists on the filesystem",
28    example: "get std::path::path_exists\n\npath_exists(\"./Cargo.toml\") // true",
29    expected_output: None,
30    returns: "",
31    errors: None,
32    see_also: &[],
33    since: None,
34};
35
36static PATH_EXTENSION: FnEntry = FnEntry {
37    signature: "path_extension(path)",
38    description: "returns the file extension of the path",
39    example: "get std::path::path_extension\n\npath_extension(\"main.rl\") // \"rl\"",
40    expected_output: None,
41    returns: "",
42    errors: None,
43    see_also: &[],
44    since: None,
45};
46
47static PATH_FILENAME: FnEntry = FnEntry {
48    signature: "path_filename(path)",
49    description: "returns the final component of the path",
50    example: "get std::path::path_filename\n\npath_filename(\"/usr/bin/rl\") // \"rl\"",
51    expected_output: None,
52    returns: "",
53    errors: None,
54    see_also: &[],
55    since: None,
56};
57
58static PATH_IS_DIR: FnEntry = FnEntry {
59    signature: "path_is_dir(path)",
60    description: "returns true if the path is a directory",
61    example: "get std::path::path_is_dir\n\npath_is_dir(\"./src\") // true",
62    expected_output: None,
63    returns: "",
64    errors: None,
65    see_also: &[],
66    since: None,
67};
68
69static PATH_IS_FILE: FnEntry = FnEntry {
70    signature: "path_is_file(path)",
71    description: "returns true if the path is a file",
72    example: "get std::path::path_is_file\n\npath_is_file(\"./Cargo.toml\") // true",
73    expected_output: None,
74    returns: "",
75    errors: None,
76    see_also: &[],
77    since: None,
78};
79
80static PATH_JOIN: FnEntry = FnEntry {
81    signature: "path_join(path, other)",
82    description: "joins two paths together",
83    example: "get std::path::path_join\n\npath_join(\"src\", \"main.rl\") // \"src/main.rl\"",
84    expected_output: None,
85    returns: "",
86    errors: None,
87    see_also: &[],
88    since: None,
89};
90
91static PATH_PARENT: FnEntry = FnEntry {
92    signature: "path_parent(path)",
93    description: "returns the parent directory of the path",
94    example: "get std::path::path_parent\n\npath_parent(\"/usr/bin/rl\") // \"/usr/bin\"",
95    expected_output: None,
96    returns: "",
97    errors: None,
98    see_also: &[],
99    since: None,
100};
101
102static PATH_POP: FnEntry = FnEntry {
103    signature: "path_pop(path)",
104    description: "removes the last component of the path and returns the result",
105    example: "get std::path::path_pop\n\npath_pop(\"/usr/bin/rl\") // \"/usr/bin\"",
106    expected_output: None,
107    returns: "",
108    errors: None,
109    see_also: &[],
110    since: None,
111};
112
113static PATH_PUSH: FnEntry = FnEntry {
114    signature: "path_push(path, target)",
115    description: "appends a component to the path and returns the result",
116    example: "get std::path::path_push\n\npath_push(\"/usr/bin\", \"rl\") // \"/usr/bin/rl\"",
117    expected_output: None,
118    returns: "",
119    errors: None,
120    see_also: &[],
121    since: None,
122};
123
124static PATH_SET_EXTENSION: FnEntry = FnEntry {
125    signature: "path_set_extension(path, extension)",
126    description: "sets or replaces the extension of the path and returns the result",
127    example: "get std::path::path_set_extension\n\npath_set_extension(\"main.rl\", \"txt\") // \"main.txt\"",
128    expected_output: None,
129    returns: "",
130    errors: None,
131    see_also: &[],
132    since: None,
133};
134
135static PATH_STEM: FnEntry = FnEntry {
136    signature: "path_stem(path)",
137    description: "returns the filename without its extension",
138    example: "get std::path::path_stem\n\npath_stem(\"main.rl\") // \"main\"",
139    expected_output: None,
140    returns: "",
141    errors: None,
142    see_also: &[],
143    since: None,
144};