Debian Codegraph @

src/lib.rs

raw symbols SCIP
1 //! Tiny library for prompting sensitive or non-sensitive data on the terminal.
2 //!
3 //! The only dependency is `libc` on Unix and `winapi` on Windows.
4 //!
5 //! See [`Terminal`] for the API documentation.
6 //!
7 //! # Example
8 //! Read a username and password from the terminal:
9 //! ```no_run
10 //! # fn main() -> std::io::Result<()> {
11 //! use terminal_prompt::Terminal;
12 //! let mut terminal = Terminal::open()?;
13 //! let username = terminal.prompt("Username: ")?;
14 //! let password = terminal.prompt_sensitive("Password: ")?;
15 //! # Ok(())
16 //! # }
17 //! ```
18
19 #![warn(missing_docs)]
20
21 use stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::iorust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/::{BufReaderrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/buffered/bufreader/BufReader#, BufReadrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/BufRead#, Readrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/Read#, Writerust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/Write#};
22
23 mod sysrust-analyzer cargo terminal-prompt 0.2.3 sys/;
24
25 /// A handle to the terminal associated with the current process.
26 ///
27 /// Once opened, you can use [`Self::prompt()`] to read non-sensitive data from the terminal,
28 /// and [`Self::prompt_sensitive()`] to read sensitive data like passwords.
29 ///
30 /// Alternatively, you can manually call [`Self::enable_echo()`] and [`Self::disable_echo()`], and read/write from the terminal directly.
31 /// The terminal handle implements the standard [`Read`], [`Write`] and [`BufRead`] traits,
32 /// and it has a [`Self::read_line()`] convenience function that returns a new string.
33 ///
34 /// # Terminal modes
35 /// When opened, the terminal will be put in line editing mode.
36 /// When dropped, the original mode of the terminal will be restored.
37 /// Note that the terminal is inherently a global resource,
38 /// so creating multiple terminal objects and dropping them in a different order can cause the terminal to be left in a different mode.
39 pub struct Terminalrust-analyzer cargo terminal-prompt 0.2.3 Terminal# {
40 /// The underlying terminal.
41 terminalrust-analyzer cargo terminal-prompt 0.2.3 Terminal#terminal.: BufReaderrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/buffered/bufreader/BufReader#<sysrust-analyzer cargo terminal-prompt 0.2.3 sys/::Terminalrust-analyzer cargo terminal-prompt 0.2.3 sys/unix/Terminal#>,
42
43 /// The mode of the terminal when we opened it.
44 initial_moderust-analyzer cargo terminal-prompt 0.2.3 Terminal#initial_mode.: sysrust-analyzer cargo terminal-prompt 0.2.3 sys/::TerminalModerust-analyzer cargo terminal-prompt 0.2.3 sys/unix/TerminalMode#,
45 }
46
47 impl Terminalrust-analyzer cargo terminal-prompt 0.2.3 Terminal# {
48 /// Open the terminal associated with the current process.
49 ///
50 /// The exact behavior is platform dependent.
51 ///
52 /// On Unix platforms, if one of standard I/O streams is a terminal, that terminal is used.
53 /// First standard error is tried, then standard input and finally standard output.
54 /// If none of those work, the function tries to open `/dev/tty`.
55 /// This means that on Unix platforms, the terminal prompt can still work, even when both standard input and standard output are connected to pipes instead of the terminal.
56 ///
57 /// On Windows, if both standard input and standard error are connected to a terminal, those streams are used.
58 ///
59 /// In all cases, if the function fails to find a terminal for the process, an error is returned.
60 pub fn openrust-analyzer cargo terminal-prompt 0.2.3 impl#[Terminal]open().() -> stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::iorust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/::Resultrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/error/Result#<Selfrust-analyzer cargo terminal-prompt 0.2.3 impl#[Terminal]> {
61 // Open the terminal and retrieve the initial mode.
62 let terminal = sysrust-analyzer cargo terminal-prompt 0.2.3 sys/::Terminalrust-analyzer cargo terminal-prompt 0.2.3 sys/unix/Terminal#::openrust-analyzer cargo terminal-prompt 0.2.3 sys/unix/impl#[Terminal]open().()?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().;
63 let initial_mode = terminal.get_terminal_moderust-analyzer cargo terminal-prompt 0.2.3 sys/unix/impl#[Terminal]get_terminal_mode().()?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().;
64
65 // Enable line editing mode.
66 let mut mode = initial_mode;
67 mode.enable_line_editingrust-analyzer cargo terminal-prompt 0.2.3 sys/unix/impl#[TerminalMode]enable_line_editing().();
68 terminal.set_terminal_moderust-analyzer cargo terminal-prompt 0.2.3 sys/unix/impl#[Terminal]set_terminal_mode().(&mode)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().;
69
70 Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(Selfrust-analyzer cargo terminal-prompt 0.2.3 impl#[Terminal] {
71 terminalrust-analyzer cargo terminal-prompt 0.2.3 Terminal#terminal.: BufReaderrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/buffered/bufreader/BufReader#::newrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/buffered/bufreader/impl#[`BufReader<R>`]new().(terminal),
72 initial_moderust-analyzer cargo terminal-prompt 0.2.3 Terminal#initial_mode.,
73 })
74 }
75
76 /// Check if the terminal is echoing input.
77 ///
78 /// If enabled, any text typed on the terminal will be visible.
79 pub fn is_echo_enabledrust-analyzer cargo terminal-prompt 0.2.3 impl#[Terminal]is_echo_enabled().(&self) -> stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::iorust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/::Resultrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/error/Result#<bool> {
80 let mode = self.terminalrust-analyzer cargo terminal-prompt 0.2.3 Terminal#terminal..get_refrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/buffered/bufreader/impl#[`BufReader<R>`]get_ref().().get_terminal_moderust-analyzer cargo terminal-prompt 0.2.3 sys/unix/impl#[Terminal]get_terminal_mode().()?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().;
81 Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(mode.is_echo_enabledrust-analyzer cargo terminal-prompt 0.2.3 sys/unix/impl#[TerminalMode]is_echo_enabled().())
82 }
83
84 /// Disable echoing of terminal input.
85 ///
86 /// This will prevent text typed on the terminal from being visible.
87 /// This can be used to hide passwords while they are being typed.
88 pub fn disable_echorust-analyzer cargo terminal-prompt 0.2.3 impl#[Terminal]disable_echo().(&self) -> stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::iorust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/::Resultrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/error/Result#<()> {
89 let mut mode = self.terminalrust-analyzer cargo terminal-prompt 0.2.3 Terminal#terminal..get_refrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/buffered/bufreader/impl#[`BufReader<R>`]get_ref().().get_terminal_moderust-analyzer cargo terminal-prompt 0.2.3 sys/unix/impl#[Terminal]get_terminal_mode().()?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().;
90 mode.disable_echorust-analyzer cargo terminal-prompt 0.2.3 sys/unix/impl#[TerminalMode]disable_echo().();
91 self.terminalrust-analyzer cargo terminal-prompt 0.2.3 Terminal#terminal..get_refrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/buffered/bufreader/impl#[`BufReader<R>`]get_ref().().set_terminal_moderust-analyzer cargo terminal-prompt 0.2.3 sys/unix/impl#[Terminal]set_terminal_mode().(&mode)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().;
92 Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(())
93 }
94
95 /// Enable echoing of terminal input.
96 ///
97 /// This will cause any text typed on the terminal to be visible.
98 pub fn enable_echorust-analyzer cargo terminal-prompt 0.2.3 impl#[Terminal]enable_echo().(&mut self) -> stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::iorust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/::Resultrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/error/Result#<()> {
99 let mut mode = self.terminalrust-analyzer cargo terminal-prompt 0.2.3 Terminal#terminal..get_refrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/buffered/bufreader/impl#[`BufReader<R>`]get_ref().().get_terminal_moderust-analyzer cargo terminal-prompt 0.2.3 sys/unix/impl#[Terminal]get_terminal_mode().()?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().;
100 mode.enable_echorust-analyzer cargo terminal-prompt 0.2.3 sys/unix/impl#[TerminalMode]enable_echo().();
101 self.terminalrust-analyzer cargo terminal-prompt 0.2.3 Terminal#terminal..get_refrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/buffered/bufreader/impl#[`BufReader<R>`]get_ref().().set_terminal_moderust-analyzer cargo terminal-prompt 0.2.3 sys/unix/impl#[Terminal]set_terminal_mode().(&mode)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().;
102 Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(())
103 }
104
105 /// Read a line of input from the terminal.
106 ///
107 /// If echoing is disabled, this will also print a newline character to visually indicate to the user.
108 /// If this is not desired, use the [`BufRead::read_line()`] function instead.
109 pub fn read_input_linerust-analyzer cargo terminal-prompt 0.2.3 impl#[Terminal]read_input_line().(&mut self) -> stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::iorust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/::Resultrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/error/Result#<Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#> {
110 let mut buffer = Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#::newrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String]new().();
111 self.terminalrust-analyzer cargo terminal-prompt 0.2.3 Terminal#terminal..read_linerust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/BufRead#read_line().(&mut buffer)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().;
112
113 if self.is_echo_enabledrust-analyzer cargo terminal-prompt 0.2.3 impl#[Terminal]is_echo_enabled().().okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]ok().() rust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`][`PartialEq<Self>`]eq().==rust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`][`PartialEq<Self>`]eq(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`][`PartialEq<Self>`]eq().Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(false) {
114 writelnrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/writeln!!(self).okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]ok().();
115 }
116 if buffer.ends_withrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]ends_with().('\n') {
117 buffer.poprust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String]pop().();
118 }
119 Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(buffer)
120 }
121
122 /// Prompt the user on the terminal.
123 ///
124 /// This function does not enable or disable echoing and should not normally be used for reading sensitive data like passwords.
125 /// Consider [`Self::prompt_sensitive()`] instead.
126 pub fn promptrust-analyzer cargo terminal-prompt 0.2.3 impl#[Terminal]prompt().(&mut self, prompt: impl stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::fmtrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc fmt/::Displayrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Display#) -> stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::iorust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/::Resultrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/error/Result#<Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#> {
127 writerust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/write!!(self, "{prompt}")?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().;
128 self.read_input_linerust-analyzer cargo terminal-prompt 0.2.3 impl#[Terminal]read_input_line().()
129 }
130
131 /// Prompt the user for sensitive data (like passwords) on the terminal.
132 ///
133 /// This function makes sure that echoing is disabled before the prompt is shown.
134 /// If echoing was enabled, it is re-enabled after the response is read.
135 ///
136 /// Use [`Self::prompt()`] to read non-sensitive data.
137 pub fn prompt_sensitiverust-analyzer cargo terminal-prompt 0.2.3 impl#[Terminal]prompt_sensitive().(&mut self, prompt: impl stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::fmtrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc fmt/::Displayrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Display#) -> stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::iorust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/::Resultrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/error/Result#<Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#> {
138 let old_mode = self.terminalrust-analyzer cargo terminal-prompt 0.2.3 Terminal#terminal..get_refrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/buffered/bufreader/impl#[`BufReader<R>`]get_ref().().get_terminal_moderust-analyzer cargo terminal-prompt 0.2.3 sys/unix/impl#[Terminal]get_terminal_mode().()?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().;
139 if old_mode.is_echo_enabledrust-analyzer cargo terminal-prompt 0.2.3 sys/unix/impl#[TerminalMode]is_echo_enabled().() {
140 let mut new_mode = old_mode;
141 new_mode.disable_echorust-analyzer cargo terminal-prompt 0.2.3 sys/unix/impl#[TerminalMode]disable_echo().();
142 self.terminalrust-analyzer cargo terminal-prompt 0.2.3 Terminal#terminal..get_refrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/buffered/bufreader/impl#[`BufReader<R>`]get_ref().().set_terminal_moderust-analyzer cargo terminal-prompt 0.2.3 sys/unix/impl#[Terminal]set_terminal_mode().(&new_mode)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().;
143 }
144 writerust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/write!!(self, "{prompt}")?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().;
145 let line = self.read_input_linerust-analyzer cargo terminal-prompt 0.2.3 impl#[Terminal]read_input_line().();
146 if old_mode.is_echo_enabledrust-analyzer cargo terminal-prompt 0.2.3 sys/unix/impl#[TerminalMode]is_echo_enabled().() {
147 self.terminalrust-analyzer cargo terminal-prompt 0.2.3 Terminal#terminal..get_refrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/buffered/bufreader/impl#[`BufReader<R>`]get_ref().().set_terminal_moderust-analyzer cargo terminal-prompt 0.2.3 sys/unix/impl#[Terminal]set_terminal_mode().(&old_mode).okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]ok().();
148 }
149 line
150 }
151 }
152
153 impl Droprust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/drop/Drop# for Terminalrust-analyzer cargo terminal-prompt 0.2.3 Terminal# {
154 fn droprust-analyzer cargo terminal-prompt 0.2.3 impl#[Terminal][Drop]drop().(&mut self) {
155 self.terminalrust-analyzer cargo terminal-prompt 0.2.3 Terminal#terminal..get_refrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/buffered/bufreader/impl#[`BufReader<R>`]get_ref().().set_terminal_moderust-analyzer cargo terminal-prompt 0.2.3 sys/unix/impl#[Terminal]set_terminal_mode().(&self.initial_moderust-analyzer cargo terminal-prompt 0.2.3 Terminal#initial_mode.).okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]ok().();
156 }
157 }
158
159 impl Readrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/Read# for Terminalrust-analyzer cargo terminal-prompt 0.2.3 Terminal# {
160 fn readrust-analyzer cargo terminal-prompt 0.2.3 impl#[Terminal][Read]read().(&mut self, buf: &mut [u8]) -> stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::iorust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/::Resultrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/error/Result#<usize> {
161 self.terminalrust-analyzer cargo terminal-prompt 0.2.3 Terminal#terminal..readrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/buffered/bufreader/impl#[`BufReader<R>`][Read]read().(buf)
162 }
163
164 fn read_vectoredrust-analyzer cargo terminal-prompt 0.2.3 impl#[Terminal][Read]read_vectored().(&mut self, bufs: &mut [stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::iorust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/::IoSliceMutrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/IoSliceMut#<'_>]) -> stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::iorust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/::Resultrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/error/Result#<usize> {
165 self.terminalrust-analyzer cargo terminal-prompt 0.2.3 Terminal#terminal..read_vectoredrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/buffered/bufreader/impl#[`BufReader<R>`][Read]read_vectored().(bufs)
166 }
167 }
168
169 impl BufReadrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/BufRead# for Terminalrust-analyzer cargo terminal-prompt 0.2.3 Terminal# {
170 fn fill_bufrust-analyzer cargo terminal-prompt 0.2.3 impl#[Terminal][BufRead]fill_buf().(&mut self) -> stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::iorust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/::Resultrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/error/Result#<&[u8]> {
171 self.terminalrust-analyzer cargo terminal-prompt 0.2.3 Terminal#terminal..fill_bufrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/buffered/bufreader/impl#[`BufReader<R>`][BufRead]fill_buf().()
172 }
173
174 fn consumerust-analyzer cargo terminal-prompt 0.2.3 impl#[Terminal][BufRead]consume().(&mut self, amt: usize) {
175 self.terminalrust-analyzer cargo terminal-prompt 0.2.3 Terminal#terminal..consumerust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/buffered/bufreader/impl#[`BufReader<R>`][BufRead]consume().(amt)
176 }
177 }
178
179 impl Writerust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/Write# for Terminalrust-analyzer cargo terminal-prompt 0.2.3 Terminal# {
180 fn writerust-analyzer cargo terminal-prompt 0.2.3 impl#[Terminal][Write]write().(&mut self, buf: &[u8]) -> stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::iorust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/::Resultrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/error/Result#<usize> {
181 self.terminalrust-analyzer cargo terminal-prompt 0.2.3 Terminal#terminal..get_mutrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/buffered/bufreader/impl#[`BufReader<R>`]get_mut().().writerust-analyzer cargo terminal-prompt 0.2.3 sys/unix/impl#[Terminal][Write]write().(buf)
182 }
183
184 fn flushrust-analyzer cargo terminal-prompt 0.2.3 impl#[Terminal][Write]flush().(&mut self) -> stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::iorust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/::Resultrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/error/Result#<()> {
185 self.terminalrust-analyzer cargo terminal-prompt 0.2.3 Terminal#terminal..get_mutrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/buffered/bufreader/impl#[`BufReader<R>`]get_mut().().flushrust-analyzer cargo terminal-prompt 0.2.3 sys/unix/impl#[Terminal][Write]flush().()
186 }
187
188 fn write_vectoredrust-analyzer cargo terminal-prompt 0.2.3 impl#[Terminal][Write]write_vectored().(&mut self, bufs: &[stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::iorust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/::IoSlicerust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/IoSlice#<'_>]) -> stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::iorust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/::Resultrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/error/Result#<usize> {
189 self.terminalrust-analyzer cargo terminal-prompt 0.2.3 Terminal#terminal..get_mutrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/buffered/bufreader/impl#[`BufReader<R>`]get_mut().().write_vectoredrust-analyzer cargo terminal-prompt 0.2.3 sys/unix/impl#[Terminal][Write]write_vectored().(bufs)
190 }
191 }