[ 
https://issues.apache.org/jira/browse/THRIFT-4664?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16683672#comment-16683672
 ] 

ASF GitHub Bot commented on THRIFT-4664:
----------------------------------------

allengeorge commented on issue #1627: THRIFT-4664: Rust cannot create 
ReadHalf/WriteHalf
URL: https://github.com/apache/thrift/pull/1627#issuecomment-437855261
 
 
   @jeikabu TY for the PR! I guess this tells you I didn't check that I could 
implement new transports from outside the crate :/ I'll make sure of that in 
the future.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


> 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
>            Assignee: Allen George
>            Priority: Minor
>
> 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)

Reply via email to