Skip to main content

Crate goish

Crate goish 

Source

Re-exports§

pub use encoding::base64;
pub use encoding::binary;
pub use encoding::csv;
pub use encoding::hex;
pub use encoding::json;
pub use math::rand;
pub use net::http;
pub use net::url;
pub use os::exec;
pub use path::filepath;
pub use unicode::utf8;
pub use crate::types::*;

Modules§

bufio
bytes
chan
consts
container
context
crypto
defer
encoding
errors
flag
fmt
goroutine
hash
io
log
math
mime
net
os
path
prelude
range
regexp
runtime
sort
strconv
strings
sync
testing
time
types
unicode

Macros§

Errorf
fmt.Errorf(format, args…) — returns an error with the formatted message. Supports %w to wrap a single error; its .Error() text replaces the verb at format time, and the returned error unwraps to the original.
Fprintf
fmt.Fprintf(w, format, args…) — writes to anything that impls io::Write. Returns (int, error).
Printf
fmt.Printf(format, args…) — Go-style verbs. Returns (int, error).
Println
fmt.Println(a, b, c) — space-separated, trailing newline. Returns (int, error).
Sprintf
fmt.Sprintf(format, args…) — returns the formatted string.
Struct
append
append!(s, x, y, z) — Go’s append(s, ...) for slices.
benchmark
benchmark!{ fn BenchmarkX(b) { … } } — registers a benchmark as a regular #[test].
chan
chan!(T) → unbuffered channel (rendezvous) chan!(T, n) → buffered channel with capacity n
close
close!(&ch) — Go’s close(ch).
const_block
const!{} — Go-style constant block with iota.
defer
defer!{ stmts } — run stmts at the end of the enclosing scope.
delete
delete!(m, k) — Go’s delete(m, k) builtin for maps.
go
go!{ stmts } — spawn a goroutine running the block.
len
len!(x) — Go’s polymorphic len() builtin.
log_Fatalf
log.Fatalf — like Printf, but then os.Exit(1).
log_Panic
log.Panic — like Printf, but then panic!.
log_Printf
log.Printf(fmt, …) — Go-style verbs, written to stderr with timestamp.
log_Println
log.Println(a, b, c) — space-separated, newline-terminated, stderr.
make
make!(...) — Go’s make() builtin: allocate empty/sized container.
map
Two forms — pick the one closest to your Go original:
range
range!(x, |i, v| body) — Go’s for i, v := range x { body } pattern.
recover
recover!{ body } — runs body; if it panics, captures the panic message as Some(String). If it completes normally, returns None.
select
select!{ ... } — Go’s select statement.
slice
Three forms — pick the one closest to your Go original:
stringer
Generate Stringer + Display + an inherent String() method from one Go-style block.
test
test!{ fn TestFoo(t) { … } } — declares a #[test] test function whose body gets a &T named t. Fatal/Skip/FailNow unwind via a sentinel panic which the macro catches and converts to a PASS/FAIL/SKIP result.
test_h
test_h!{ fn TestX(t) { … } } — variant for custom-harness test files (harness = false). Emits a plain function + an inventory registration so test_main!’s generated main() can discover and run it via m.Run().
test_main
test_main!{ fn TestMain(m) { … } } — generate a Go-shape TestMain.