# Add \`buffer()\` to \`StdinLock\` structure

**URL:** <https://internals.rust-lang.org/t/add-buffer-to-stdinlock-structure/14837>\
**Category:** libs\
**Created:** [June 5, 2021, 12:06am UTC](https://internals.rust-lang.org/t/add-buffer-to-stdinlock-structure/14837 "2021-06-05T00:06:41Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![notoria](https://sea2.discourse-cdn.com/flex002/user_avatar/internals.rust-lang.org/notoria/32/8224_2.png) [@notoria](https://internals.rust-lang.org/u/notoria)\
**Post date:** [June 5, 2021, 12:06am UTC](https://internals.rust-lang.org/t/add-buffer-to-stdinlock-structure/14837/1 "2021-06-05T00:06:42Z")

</div>

The structure `BufReader` provides the method `buffer()` and `StdinLock` uses `BufReader`, so `StdinLock` can provides `buffer()` too for the user.

---

<div class="post-metadata">

**Author:** ![jjpe](https://sea2.discourse-cdn.com/flex002/user_avatar/internals.rust-lang.org/jjpe/32/9779_2.png) [@jjpe](https://internals.rust-lang.org/u/jjpe)\
**Post date:** [June 5, 2021, 12:16pm UTC](https://internals.rust-lang.org/t/add-buffer-to-stdinlock-structure/14837/2 "2021-06-05T12:16:06Z")

</div>

AFAIK stdin is unbuffered. So given that there is no buffer to return, what exactly should such a `StdinLock::buffer()` method return?

---

<div class="post-metadata">

**Author:** ![quinedot](https://sea2.discourse-cdn.com/flex002/user_avatar/internals.rust-lang.org/quinedot/32/7294_2.png) [@quinedot](https://internals.rust-lang.org/u/quinedot)\
**Post date:** [June 5, 2021, 9:17pm UTC](https://internals.rust-lang.org/t/add-buffer-to-stdinlock-structure/14837/3 "2021-06-05T21:17:46Z")

</div>

[It contains a `BufReader`](https://doc.rust-lang.org/src/std/io/stdio.rs.html#309) (and [`StdinLock` implements `BufRead`](https://doc.rust-lang.org/std/io/struct.StdinLock.html#impl-BufRead)).

---

<div class="post-metadata">

**Author:** ![system](https://sea2.discourse-cdn.com/flex002/user_avatar/internals.rust-lang.org/system/32/14092_2.png) [@system](https://internals.rust-lang.org/u/system)\
**Post date:** [September 3, 2021, 9:18pm UTC](https://internals.rust-lang.org/t/add-buffer-to-stdinlock-structure/14837/4 "2021-09-03T21:18:30Z")

</div>

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.
