Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 1 of 1 for _new (0.02 sec)

  1. internal/ringbuffer/README.md

    	"github.com/smallnest/ringbuffer"
    )
    
    func main() {
    	rb := ringbuffer.New(1024)
    
    	// write
    	rb.Write([]byte("abcd"))
    	fmt.Println(rb.Length())
    	fmt.Println(rb.Free())
    
    	// read
    	buf := make([]byte, 4)
    	rb.Read(buf)
    	fmt.Println(string(buf))
    }
    ```
    
    It is possible to use an existing buffer with by replacing `New` with `NewBuffer`.
    
    
    # Blocking vs Non-blocking
    
    Registered: Sun Jun 16 00:44:34 UTC 2024
    - Last Modified: Wed May 15 00:11:04 UTC 2024
    - 2.1K bytes
    - Viewed (0)
Back to top