Skip to content

Generic stream transport#199

Merged
einarmo merged 1 commit intomasterfrom
stream-transport
Feb 24, 2026
Merged

Generic stream transport#199
einarmo merged 1 commit intomasterfrom
stream-transport

Conversation

@einarmo
Copy link
Copy Markdown
Contributor

@einarmo einarmo commented Jan 30, 2026

This extracts some of the core logic from TcpConnector and TcpTransport to a more general StreamConnector and StreamTransport. This is essentially the same as before, except we operate over AsyncRead and AsyncWrite. To facilite this, users need to provide a generic C: Fn(...) -> Future<Output = Result<R, W>>, effectively providing their own custom connection establishment.

This makes it possible to have custom transport implementations that don't rely on a raw TCP stream. In fact, TcpTransport is now just a type alias StreamTransport<ReadHalf<TcpStream>, WriteHalf<TcpStream>>.

Getting the correct generic bounds was a little fiddly, but this seems to work pretty well. I consider this to close #194, as it would allow a user to create a StreamConnector with a custom wrapped stream, though not through quite as simple an interface as they request there.

@einarmo
Copy link
Copy Markdown
Contributor Author

einarmo commented Feb 23, 2026

Once this is merged I figured we'd cut a release. There's been some bug fixes that it would be good to get a new release for.

@svanharmelen
Copy link
Copy Markdown
Contributor

I will test this branch today...

Comment thread async-opcua-client/src/transport/core.rs
Comment thread async-opcua-client/src/transport/stream.rs
Comment thread async-opcua-client/src/transport/tcp.rs Outdated
This extracts some of the core logic from `TcpConnector` and
`TcpTransport` to a more general `StreamConnector` and
`StreamTransport`. This is essentially the same as before, except we
operate over `AsyncRead` and `AsyncWrite`. To facilite this, users
need to provide a generic `C: Fn(...) -> Future<Output = Result<R, W>>`,
effectively providing their own custom connection establishment.

This makes it possible to have custom transport implementations that
don't rely on a raw TCP stream.
@einarmo einarmo merged commit 123a17c into master Feb 24, 2026
6 checks passed
@einarmo einarmo deleted the stream-transport branch February 24, 2026 05:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Expose a connect_with_stream or transport-connector API for the OPC UA client (tokio)

2 participants