J W created THRIFT-4664:
---------------------------
Summary: Rust cannot create ReadHalf/WriteHalf to implement custom
tranports
Key: THRIFT-4664
URL: https://issues.apache.org/jira/browse/THRIFT-4664
Project: Thrift
Issue Type: Improvement
Components: Rust - Library
Affects Versions: 0.11.0
Environment: C:\Users\jake>rustup show
Default host: x86_64-pc-windows-msvc
stable-x86_64-pc-windows-msvc (default)
rustc 1.30.0 (da5f414c2 2018-10-24)
Reporter: J W
To implement custom transports ("channels") looks like the intention is:
# Optionally, `impl TIoChannel for XXX` providing a split()
# Create `ReadHalf` and `WriteHalf` as passed to various `XXXProtocol::new()`
associated functions
Problems is:
{code:java}
use thrift::transport::{
TIoChannel,
ReadHalf,
WriteHalf,
};
impl TIoChannel for TNngChannel {
fn split(self) -> thrift::Result<(ReadHalf<Self>, WriteHalf<Self>)> where Self:
Sized,
{
//SNIP
Ok((
ReadHalf { handle: self },
WriteHalf { handle: clone }
))
}
{code}
Results in:
error[E0451]: field `handle` of struct `thrift::transport::ReadHalf` is private
--> runng-thrift\src\nng_channel.rs:57:24
|
57 | ReadHalf \{ handle: self },
| ^^^^^^^^^^^^ field `handle` is private
To enable creation of custom tranports/channels need to be able to create
`ReadHalf` and `WriteHalf` from outside the crate.
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)