read_line
fn read_line(Stream s) -> Result<Option<string>, IoError> Import
Source: use io::sync::{read_line}; src/io/sync.hy Reads one line from s, without its line ending (LF or CRLF).
Returns None at the end of the stream. A last line without a newline is
still returned.
Parameters#
| Name | Type |
|---|---|
s | Stream |
Returns#
Result<Option<string>, IoError>
Examples#
use io::{stdin};
use io::sync::{read_line, println};
fn main() {
while let Option::Some(line) = read_line(stdin())? {
println(line)?;
}
}
See also#
write_all: Writes all ofbuftos, waiting whenever the stream is not ready.read_exact: Fills all ofbuffroms, waiting whenever no data is ready.read_to_end: Reads fromsuntil it ends and returns everything read.accept_wait: Waits for the next connection on a TCPlistenerand returns its stream.recv_from_wait: Waits for a UDP datagram, reads it intobuf, and returns(bytes, sender host, sender port).send_to_wait: Sendsbufas one UDP datagram tohost:port, waiting while the socket is not ready.copy: Copies the filesrctodst.print: Writessto standard output, without a newline.