Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 4 of 4 for UnreadRune (0.1 sec)

  1. src/bytes/reader.go

    	r.i += int64(size)
    	return
    }
    
    // UnreadRune complements [Reader.ReadRune] in implementing the [io.RuneScanner] interface.
    func (r *Reader) UnreadRune() error {
    	if r.i <= 0 {
    		return errors.New("bytes.Reader.UnreadRune: at beginning of slice")
    	}
    	if r.prevRune < 0 {
    		return errors.New("bytes.Reader.UnreadRune: previous operation was not ReadRune")
    	}
    	r.i = int64(r.prevRune)
    Registered: Tue Nov 05 11:13:11 UTC 2024
    - Last Modified: Tue Jul 16 18:17:37 UTC 2024
    - 3.9K bytes
    - Viewed (0)
  2. src/bytes/buffer.go

    	return r, n, nil
    }
    
    // UnreadRune unreads the last rune returned by [Buffer.ReadRune].
    // If the most recent read or write operation on the buffer was
    // not a successful [Buffer.ReadRune], UnreadRune returns an error.  (In this regard
    // it is stricter than [Buffer.UnreadByte], which will unread the last byte
    // from any read operation.)
    func (b *Buffer) UnreadRune() error {
    	if b.lastRead <= opInvalid {
    Registered: Tue Nov 05 11:13:11 UTC 2024
    - Last Modified: Tue Oct 29 16:47:05 UTC 2024
    - 15.7K bytes
    - Viewed (0)
  3. src/bufio/bufio_test.go

    		t.Error("unexpected error on ReadRune (1):", err)
    	}
    	if err = r.UnreadRune(); err != nil {
    		t.Error("unexpected error on UnreadRune (1):", err)
    	}
    	if r.UnreadRune() == nil {
    		t.Error("expected error after UnreadRune (1)")
    	}
    	// Test error after Read.
    	_, _, err = r.ReadRune() // reset state
    	if err != nil {
    		t.Error("unexpected error on ReadRune (2):", err)
    	}
    	_, err = r.Read(buf)
    	if err != nil {
    Registered: Tue Nov 05 11:13:11 UTC 2024
    - Last Modified: Fri Nov 01 21:52:12 UTC 2024
    - 51.6K bytes
    - Viewed (0)
  4. src/bytes/buffer_test.go

    		}
    	}
    
    	// Check that UnreadRune works
    	buf.Reset()
    
    	// check at EOF
    	if err := buf.UnreadRune(); err == nil {
    		t.Fatal("UnreadRune at EOF: got no error")
    	}
    	if _, _, err := buf.ReadRune(); err == nil {
    		t.Fatal("ReadRune at EOF: got no error")
    	}
    	if err := buf.UnreadRune(); err == nil {
    		t.Fatal("UnreadRune after ReadRune at EOF: got no error")
    	}
    
    Registered: Tue Nov 05 11:13:11 UTC 2024
    - Last Modified: Tue Sep 03 20:55:15 UTC 2024
    - 18.6K bytes
    - Viewed (0)
Back to top