-
Notifications
You must be signed in to change notification settings - Fork 0
Open
Labels
Description
Move to a Result<T> system of static methods on types like String and Vector which can fail when allocating memory such that the constructor cannot fail. That means copies like the following:
String foo = "something that can fail";Will no longer compile and instead you'll have to write:
Result<String> foo = "something that can fail";Which will be enabled by Result<T> calling a special init_from_result static method.
Similarly, constructors like
Vector<Byte> data{1024};Will no longer work, instead you'll write something like:
auto data = Vector<Byte>::create_with_size(1024);Which gives a Result<Vector<Byte>> data
And likewise, copy constructors will call special copy_from_result static methods, so
Result<String> a = "hello world";
String b = move(*a);
String c = b; // error
Result<String> d = b; // worksThe Result<T> type is special in that it will allow anything returning Result<T> to return an Error type which is just a wrapped String indicating the resulting error.
Reactions are currently unavailable