Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Correct and update comment on TTYPort #183

Merged
merged 3 commits into from
May 6, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 9 additions & 9 deletions src/posix/tty.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,14 @@ fn close(fd: RawFd) {

/// A serial port implementation for POSIX TTY ports
///
/// The port will be closed when the value is dropped. However, this struct
/// should not be instantiated directly by using `TTYPort::open()`, instead use
/// the cross-platform `serialport::open()` or
/// `serialport::open_with_settings()`.
/// The port will be closed when the value is dropped. This struct
/// should not be instantiated directly by using `TTYPort::open()`.
/// Instead, use the cross-platform `serialport::new()`. Example:
///
/// ```no_run
/// let mut port = serialport::new("/dev/ttyS0", 115200).open().expect("Unable to open");
/// # let _ = &mut port;
/// ```
///
/// Note: on macOS, when connecting to a pseudo-terminal (`pty` opened via
/// `posix_openpt`), the `baud_rate` should be set to 0; this will be used to
Expand All @@ -47,14 +51,10 @@ fn close(fd: RawFd) {
/// use serialport::{TTYPort, SerialPort};
///
/// let (mut master, mut slave) = TTYPort::pair().expect("Unable to create ptty pair");
///
/// # let _ = &mut master;
/// # let _ = &mut slave;
///
/// // ... elsewhere
///
/// let mut port = TTYPort::open(&serialport::new(slave.name().unwrap(), 0)).expect("unable to open");
///
/// let mut port = TTYPort::open(&serialport::new(slave.name().unwrap(), 0)).expect("Unable to open");
/// # let _ = &mut port;
/// ```
#[derive(Debug)]
Expand Down
Loading