fish-shell/src
Johannes Altmanninger 1df64a4891 Replace maybe_t::missing_or_empty with a more Rust-friendly helper
There are many places where we want to treat a missing variable the same as
a variable with an empty value.

In C++ we handle this by branching on maybe_t<env_var_t>::missing_or_empty().
If it returns false, we go on to access maybe_t<env_var_t>::value() aka
operator*.

In Rust, Environment::get() will return an Option<EnvVar>.
We could define a MissingOrEmpty trait and implement it for Option<EnvVar>.

However that will still leave us with ugly calls to Option::unwrap()
(by convention Rust does use shorthands like *).

Let's add a variable getter that returns none for empty variables.
2023-04-21 13:57:29 +02:00
..
builtins Replace maybe_t::missing_or_empty with a more Rust-friendly helper 2023-04-21 13:57:29 +02:00
widecharwidth Upgrade widechar_width to Unicode 15 2022-09-26 17:17:17 +02:00
abbrs.h abbr: port abbreviation and abbr builtin to rust 2023-02-25 12:24:58 +01:00
ast.cpp Port AST to Rust 2023-04-16 17:46:56 +02:00
ast.h Port AST to Rust 2023-04-16 17:46:56 +02:00
autoload.cpp clang-format C++ files 2023-04-19 22:43:36 +02:00
autoload.h Delete wcstring_list_t 2023-04-19 01:03:16 +02:00
builtin.cpp clang-format C++ files 2023-04-19 22:43:36 +02:00
builtin.h clang-format C++ files 2023-04-19 22:43:36 +02:00
color.cpp Delete wcstring_list_t 2023-04-19 01:03:16 +02:00
color.h Delete wcstring_list_t 2023-04-19 01:03:16 +02:00
common.cpp clang-format C++ files 2023-04-19 22:43:36 +02:00
common.h Delete wcstring_list_t 2023-04-19 01:03:16 +02:00
complete.cpp clang-format C++ files 2023-04-19 22:43:36 +02:00
complete.h Delete wcstring_list_t 2023-04-19 01:03:16 +02:00
enum_map.h enum_map stuff to enum_map.h 2021-10-01 03:39:43 -07:00
enum_set.h Remove enum_iter_t 2023-01-14 12:58:20 -08:00
env.cpp Replace maybe_t::missing_or_empty with a more Rust-friendly helper 2023-04-21 13:57:29 +02:00
env.h Replace maybe_t::missing_or_empty with a more Rust-friendly helper 2023-04-21 13:57:29 +02:00
env_dispatch.cpp Replace maybe_t::missing_or_empty with a more Rust-friendly helper 2023-04-21 13:57:29 +02:00
env_dispatch.h Revert "I need to take a break. Fixup." 2022-08-22 14:11:52 -07:00
env_universal_common.cpp Delete wcstring_list_t 2023-04-19 01:03:16 +02:00
env_universal_common.h Delete wcstring_list_t 2023-04-19 01:03:16 +02:00
event.cpp Delete wcstring_list_t 2023-04-19 01:03:16 +02:00
event.h Delete wcstring_list_t 2023-04-19 01:03:16 +02:00
exec.cpp Replace maybe_t::missing_or_empty with a more Rust-friendly helper 2023-04-21 13:57:29 +02:00
exec.h Delete wcstring_list_t 2023-04-19 01:03:16 +02:00
expand.cpp Replace maybe_t::missing_or_empty with a more Rust-friendly helper 2023-04-21 13:57:29 +02:00
expand.h Delete wcstring_list_t 2023-04-19 01:03:16 +02:00
fallback.cpp clang-format C++ files 2023-02-25 12:24:25 +01:00
fallback.h IWYU 2022-09-12 18:34:19 -07:00
fds.cpp New wcs2zstring to explicitly convert to zero-terminated strings 2023-04-02 15:17:06 +02:00
fds.h Port fd_monitor (and its needed components) 2023-02-19 15:42:03 -06:00
ffi.h Delete wcstring_list_t 2023-04-19 01:03:16 +02:00
ffi_baggage.h Port AST to Rust 2023-04-16 17:46:56 +02:00
fish.cpp Tease apart parser.eval() overloads 2023-04-21 13:57:29 +02:00
fish_indent.cpp Port AST to Rust 2023-04-16 17:46:56 +02:00
fish_indent_common.cpp Port AST to Rust 2023-04-16 17:46:56 +02:00
fish_indent_common.h Port AST to Rust 2023-04-16 17:46:56 +02:00
fish_key_reader.cpp Port AST to Rust 2023-04-16 17:46:56 +02:00
fish_test_helper.cpp Initial Rust commit 2023-02-02 19:34:47 -07:00
fish_tests.cpp Replace maybe_t::missing_or_empty with a more Rust-friendly helper 2023-04-21 13:57:29 +02:00
fish_version.cpp Fix build 2021-09-21 18:33:14 -07:00
fish_version.h Revert "Generate FISH_BUILD_VERSION info for cmake builds" 2018-01-08 22:28:10 -08:00
flog.cpp Initial Rust commit 2023-02-02 19:34:47 -07:00
flog.h Delete wcstring_list_t 2023-04-19 01:03:16 +02:00
function.cpp Replace maybe_t::missing_or_empty with a more Rust-friendly helper 2023-04-21 13:57:29 +02:00
function.h clang-format C++ files 2023-04-19 22:43:36 +02:00
future_feature_flags.h Follow Rust naming convention for some types 2023-02-08 21:49:54 +01:00
global_safety.h IWYU-guided #include rejiggering. 2022-08-20 23:55:18 -07:00
highlight.cpp Replace maybe_t::missing_or_empty with a more Rust-friendly helper 2023-04-21 13:57:29 +02:00
highlight.h clang-format C++ files 2023-04-19 22:43:36 +02:00
history.cpp Replace maybe_t::missing_or_empty with a more Rust-friendly helper 2023-04-21 13:57:29 +02:00
history.h Delete wcstring_list_t 2023-04-19 01:03:16 +02:00
history_file.cpp history_file.cpp: remove an unused variable 2022-10-26 16:09:02 +02:00
history_file.h clang-format all C++ files 2022-08-21 15:02:19 -07:00
input.cpp clang-format C++ files 2023-04-19 22:43:36 +02:00
input.h clang-format C++ files 2023-04-19 22:43:36 +02:00
input_common.cpp Replace maybe_t::missing_or_empty with a more Rust-friendly helper 2023-04-21 13:57:29 +02:00
input_common.h IWYU-guided #include rejiggering. 2022-08-20 23:55:18 -07:00
io.cpp clang-format C++ files 2023-02-25 12:24:25 +01:00
io.h io: add FFI wrappers for io_streams_t fields 2023-04-16 22:26:46 +02:00
iothread.cpp Initial Rust commit 2023-02-02 19:34:47 -07:00
iothread.h IWYU-guided #include rejiggering. 2022-08-20 23:55:18 -07:00
kill.cpp Delete wcstring_list_t 2023-04-19 01:03:16 +02:00
kill.h Delete wcstring_list_t 2023-04-19 01:03:16 +02:00
lru.h Reimplement autosuggestion-triggered completion loading 2022-06-19 15:15:17 -07:00
maybe.h Replace maybe_t::missing_or_empty with a more Rust-friendly helper 2023-04-21 13:57:29 +02:00
null_terminated_array.cpp Delete wcstring_list_t 2023-04-19 01:03:16 +02:00
null_terminated_array.h Delete wcstring_list_t 2023-04-19 01:03:16 +02:00
operation_context.cpp clang-format all C++ files 2022-08-21 15:02:19 -07:00
operation_context.h Port job_group to rust (#9608) 2023-02-25 16:42:45 -06:00
output.cpp Spelling fixes 2022-10-28 20:10:09 -07:00
output.h IWYU-guided #include rejiggering. 2022-08-20 23:55:18 -07:00
pager.cpp Delete wcstring_list_t 2023-04-19 01:03:16 +02:00
pager.h Delete wcstring_list_t 2023-04-19 01:03:16 +02:00
parse_constants.h Don't leak ParseErrorList FFI crutch type into Rust 2023-04-19 01:03:16 +02:00
parse_execution.cpp Rename kw() to keyword() also in C++ 2023-04-19 22:43:36 +02:00
parse_execution.h Delete wcstring_list_t 2023-04-19 01:03:16 +02:00
parse_tree.h Port AST to Rust 2023-04-16 17:46:56 +02:00
parse_util.cpp Rename kw() to keyword() also in C++ 2023-04-19 22:43:36 +02:00
parse_util.h Port parse_util_compute_indents 2023-04-19 10:35:22 +02:00
parser.cpp Tease apart parser.eval() overloads 2023-04-21 13:57:29 +02:00
parser.h Tease apart parser.eval() overloads 2023-04-21 13:57:29 +02:00
parser_keywords.cpp IWYU-guided #include rejiggering. 2022-08-20 23:55:18 -07:00
parser_keywords.h Remove unused functions, members (and a variable) 2022-04-09 10:10:44 -07:00
path.cpp Replace maybe_t::missing_or_empty with a more Rust-friendly helper 2023-04-21 13:57:29 +02:00
path.h clang-format C++ files 2023-04-19 22:43:36 +02:00
postfork.cpp Port job_group to rust (#9608) 2023-02-25 16:42:45 -06:00
postfork.h Mark Dup2List as a struct, not a class 2023-02-11 12:13:51 -08:00
print_help.cpp Revert "Re-implement macro to constexpr transition" 2022-09-20 11:58:37 -07:00
print_help.h restyle proc module to match project style 2016-05-02 22:07:58 -07:00
proc.cpp Port AST to Rust 2023-04-16 17:46:56 +02:00
proc.h Delete wcstring_list_t 2023-04-19 01:03:16 +02:00
re.cpp Delete wcstring_list_t 2023-04-19 01:03:16 +02:00
re.h Delete wcstring_list_t 2023-04-19 01:03:16 +02:00
reader.cpp Tease apart parser.eval() overloads 2023-04-21 13:57:29 +02:00
reader.h Remove abbreviation triggers 2022-12-10 16:15:00 -08:00
redirection.h redirection.rs: don't leak FFI type into Rust code 2023-04-16 17:21:54 +02:00
rustffi.cpp Initial Rust commit 2023-02-02 19:34:47 -07:00
screen.cpp Adopt the new termsize 2023-03-19 16:13:41 -07:00
screen.h Delete wcstring_list_t 2023-04-19 01:03:16 +02:00
signals.cpp Adopt the new termsize 2023-03-19 16:13:41 -07:00
signals.h Initial Rust commit 2023-02-02 19:34:47 -07:00
termsize.h Adopt the new termsize 2023-03-19 16:13:41 -07:00
tokenizer.h Port tokenizer.cpp to Rust 2023-02-09 00:37:22 +01:00
topic_monitor.h Initial Rust commit 2023-02-02 19:34:47 -07:00
utf8.cpp Revert "Re-implement macro to constexpr transition" 2022-09-20 11:58:37 -07:00
utf8.h Revert "Re-implement macro to constexpr transition" 2022-09-20 11:58:37 -07:00
util.h Port util.cpp to Rust 2023-02-03 18:55:06 +01:00
wait_handle.h Rewrite wait handles and wait handle store in Rust 2023-03-18 18:53:04 -07:00
wcstringutil.cpp clang-format C++ files 2023-04-19 22:43:36 +02:00
wcstringutil.h clang-format C++ files 2023-04-19 22:43:36 +02:00
wgetopt.cpp Use actual enum names in wgetopt 2022-12-11 10:26:39 -08:00
wgetopt.h Untangle some pointers in wgetopt 2022-12-04 14:48:20 -08:00
wildcard.cpp Port common.{h,cpp} to Rust 2023-04-02 15:17:06 +02:00
wildcard.h IWYU-guided #include rejiggering. 2022-08-20 23:55:18 -07:00
wutil.cpp Delete wcstring_list_t 2023-04-19 01:03:16 +02:00
wutil.h Delete wcstring_list_t 2023-04-19 01:03:16 +02:00