Skip to content

Commit

Permalink
docs: update README and package doc
Browse files Browse the repository at this point in the history
Change-Id: Id0c2d4582d9859412076f63a44d640648b27bc82
  • Loading branch information
andeya committed Nov 18, 2022
1 parent 108a6a1 commit c4816dc
Show file tree
Hide file tree
Showing 6 changed files with 21 additions and 5 deletions.
14 changes: 13 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# gust [![Docs](https://img.shields.io/badge/Docs-pkg.go.dev-blue.svg?style=flat-square)](https://pkg.go.dev/github.com/andeya/gust)

A Rust-inspired **declarative programming** module for Golang that helps reduce bugs and improve development efficiency. For example results, options, iterators, etc.
A Rust-inspired **declarative generic programming module** for Golang that helps reduce bugs and improve development efficiency.

![declarative_vs_imperative.jpg](doc/declarative_vs_imperative.jpg)

Expand Down Expand Up @@ -60,6 +60,18 @@ go≥1.19

## Features

- `gust.Result` is a type that represents either a success or an error.
- `gust.Option` is a type that represents either a value or nothing.
- `gust.Mutex` is a better generic-type wrapper for `sync.Mutex` that holds a value.
- `gust.RWMutex` is a better generic-type wrapper for `sync.RWMutex` that holds a value.
- `gust.SyncMap` is a better generic-type wrapper for `sync.Map`.
- `gust.AtomicValue` is a better generic-type wrapper for `atomic.Value`.
- `iter` is a package that provides a generic-type iterator type.
- `vec` is a toolkit for efficient handling of generic-type slices.
- `valconv` is a package that provides a generic-type value converter.
- `digit` is a package that provides generic-type digit operations.
- and more...

### Result

Improve `func() (T,error)`, handle result with chain methods.
Expand Down
1 change: 1 addition & 0 deletions digit/dict_num.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// Package digit is a package that provides generic-type digit operations.
package digit

import (
Expand Down
1 change: 1 addition & 0 deletions iter/export.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// Package iter is a package that provides a generic-type iterator type.
package iter

import (
Expand Down
8 changes: 4 additions & 4 deletions sync.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ func NewRWMutex[T any](data T) *RWMutex[T] {
return &RWMutex[T]{data: data}
}

// Mutex is a wrapper of `sync.Mutex` that holds a value.
// Mutex is a better generic-type wrapper for `sync.Mutex` that holds a value.
// A Mutex is a mutual exclusion lock.
// The zero value for a Mutex is an unlocked mutex.
//
Expand Down Expand Up @@ -65,7 +65,7 @@ func (m *Mutex[T]) Unlock(newData ...T) {
m.inner.Unlock()
}

// RWMutex is a wrapper of `sync.RWMutex` that holds a value.
// RWMutex is a better generic-type wrapper for `sync.RWMutex` that holds a value.
// A RWMutex is a reader/writer mutual exclusion lock.
// The lock can be held by an arbitrary number of readers or a single writer.
// The zero value for a RWMutex is an unlocked mutex.
Expand Down Expand Up @@ -166,7 +166,7 @@ func (m *RWMutex[T]) RUnlock() {
m.inner.RUnlock()
}

// SyncMap is a wrapper of `sync.Map` that holds a value.
// SyncMap is a better generic-type wrapper for `sync.Map`.
// A SyncMap is like a Go map[interface{}]interface{} but is safe for concurrent use
// by multiple goroutines without additional locking or coordination.
// Loads, stores, and deletes run in amortized constant time.
Expand Down Expand Up @@ -244,7 +244,7 @@ func (m *SyncMap[K, V]) Range(f func(key K, value V) bool) {
})
}

// AtomicValue is a wrapper of `atomic.Value` that holds a value.
// AtomicValue is a better generic-type wrapper for `atomic.Value`.
// A AtomicValue provides an atomic load and store of a consistently typed value.
// The zero value for a AtomicValue returns nil from Load.
// Once Store has been called, a AtomicValue must not be copied.
Expand Down
1 change: 1 addition & 0 deletions valconv/convert.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// Package valconv is a package that provides a generic-type value converter.
package valconv

import (
Expand Down
1 change: 1 addition & 0 deletions vec/vec.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// Package vec is a toolkit for efficient handling of generic-type slices.
package vec

import (
Expand Down

0 comments on commit c4816dc

Please sign in to comment.