Expand description
compat module contains functions that ease porting of Go code to Rust. These functions are intended for internal usage only.
Modules
Structs
- Defer allows to run a piece of code when a specific scope is finished. It is somewhat similar to Go’s defer statement, but Go’s defer runs at the function end, this Defer runs at the scope exit.
- DeferDirRemoval runs recursive directory removal when the object goes out of the scope. Errors during removal are ignored.
Functions
- Copy data from one buffer to another similar to what Go copy function does.
- It is not possible to copy std::io::Error directly because it doesn’t implement Copy trait. This function creates a new std::io::Error with the same error kind and a message copied from the original error.
- Copy data from one place of the buffer to another similar to what Go copy function can do.
- string converts a byte slice into a string. This is somewhat similar to Go
string(b)
, but not exactly. In Go any sequence of bytes can be converted into a string, but in Rust a string can contain only valid utf-8. This function panics if the byte slice cannot be converted into a valid Rust string.