Crates.io | wurm |
lib.rs | wurm |
version | 1.1.0 |
source | src |
created_at | 2022-09-07 06:31:33.492654 |
updated_at | 2022-09-07 19:09:27.531874 |
description | Non-fatal, strongly typed errors |
homepage | https://github.com/alex65536/wurm |
repository | https://github.com/alex65536/wurm |
max_upload_size | |
id | 660061 |
size | 18,879 |
By default, errors in Rust are handled using Result<T, E>
, which contains either a value
or an error. But sometimes, you need to return a value alongside with one or many errors. In this
case, you may need to use wurm
.
Think of non-fatal errors as compiler warnings. The compiler will give you the result (i.e. the compiled binary) even if there are tons of warnings. You also receive the warnings and can inspect them to decide what to do.
As an alternative, you may just use a logger to yield such non-fatal errors, but you lose flexibility, because your errors will be just strings sent into a logger, and inspecting them from code can be problematic.
For motivating example and API documentation, go to the docs.
It's just modified word "warn" (as non-fatal errors can be also called warnings). So, "warn" → "würm" sound pretty similar.
This project is licensed under the MIT License. See LICENSE for more details.