mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 04:17:35 +00:00
LibKeyboard: Change some Optional<T> returns to ErrorOr<T>
Makes CharacterMapFile::load_from_file and CharacterMap::load_from_file return ErrorOr instead of Optional. This makes them a little nicer to use and a little easier to read, as they seem to have been approximating this.
This commit is contained in:
parent
017135b44e
commit
4e65c4dae4
5 changed files with 10 additions and 22 deletions
|
@ -17,13 +17,11 @@ namespace Keyboard {
|
|||
#ifndef KERNEL
|
||||
// The Kernel explicitly and exclusively links only this file into it.
|
||||
// Thus, we cannot even include a reference to the symbol `CharacterMapFile::load_from_file`.
|
||||
Optional<CharacterMap> CharacterMap::load_from_file(const String& map_name)
|
||||
ErrorOr<CharacterMap> CharacterMap::load_from_file(const String& map_name)
|
||||
{
|
||||
auto result = CharacterMapFile::load_from_file(map_name);
|
||||
if (!result.has_value())
|
||||
return {};
|
||||
auto result = TRY(CharacterMapFile::load_from_file(map_name));
|
||||
|
||||
return CharacterMap(map_name, result.value());
|
||||
return CharacterMap(map_name, result);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue