Skip to content

Make SerialOutstation::open synchronous #434

Description

@jadamcrain

Problem

The new unstable SerialOutstation::open API is declared async:

pub async fn open(
    self,
    path: &str,
    settings: SerialSettings,
) -> std::io::Result<SerialOutstationTask>

The implementation contains no await. It calls crate::serial::open, which calls the synchronous tokio_serial::SerialStream::open, and then constructs the task.

The async signature suggests that opening the port is performed asynchronously, and it requires callers to create and drive a future even though the operation completes synchronously.

Proposed change

Make open a synchronous method:

pub fn open(
    self,
    path: &str,
    settings: SerialSettings,
) -> std::io::Result<SerialOutstationTask>

The API is currently behind the unstable feature, so this is a good time to correct the signature before stabilization.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions