Uploaded image for project: 'Thrift'
  1. Thrift
  2. THRIFT-4664

Rust cannot create ReadHalf/WriteHalf to implement custom tranports

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Closed
    • Minor
    • Resolution: Fixed
    • 0.11.0
    • 0.12.0
    • Rust - Library
    • None
    • 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)

    Description

      To implement custom transports ("channels") looks like the intention is:

      1. Optionally, `impl TIoChannel for XXX` providing a split()
      2. Create `ReadHalf` and `WriteHalf` as passed to various `XXXProtocol::new()` associated functions

      Problems is:

      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 }
          ))
      }
      

      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.

      Attachments

        Issue Links

          Activity

            People

              allengeorge Allen George
              jeikabu J W
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: