Skip to content

Commit 5b29d0b

Browse files
authored
Merge pull request #134 from jonhoo/relax-ref-bounds
Relax bounds for get_ref and get_mut
2 parents 3d138eb + da83919 commit 5b29d0b

File tree

7 files changed

+34
-20
lines changed

7 files changed

+34
-20
lines changed

.circleci/config.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,6 @@ workflows:
6363
jobs:
6464
- linux:
6565
name: openssl
66-
image: 1.30.0-stretch
66+
image: 1.32.0-stretch
6767
- macos:
68-
version: 1.30.0
68+
version: 1.32.0

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ libc = "0.2"
1818
tempfile = "3.0"
1919

2020
[target.'cfg(target_os = "windows")'.dependencies]
21-
schannel = "0.1.13"
21+
schannel = "0.1.16"
2222

2323
[target.'cfg(not(any(target_os = "windows", target_os = "macos", target_os = "ios")))'.dependencies]
2424
log = "0.4.5"

appveyor.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
environment:
2-
RUST_VERSION: 1.30.0
2+
RUST_VERSION: 1.32.0
33
TARGET: x86_64-pc-windows-msvc
44
install:
55
- ps: Start-FileDownload "https://static.rust-lang.org/dist/rust-${env:RUST_VERSION}-${env:TARGET}.exe"

src/imp/openssl.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -332,15 +332,17 @@ impl<S: fmt::Debug> fmt::Debug for TlsStream<S> {
332332
}
333333
}
334334

335-
impl<S: io::Read + io::Write> TlsStream<S> {
335+
impl<S> TlsStream<S> {
336336
pub fn get_ref(&self) -> &S {
337337
self.0.get_ref()
338338
}
339339

340340
pub fn get_mut(&mut self) -> &mut S {
341341
self.0.get_mut()
342342
}
343+
}
343344

345+
impl<S: io::Read + io::Write> TlsStream<S> {
344346
pub fn buffered_read_size(&self) -> Result<usize, Error> {
345347
Ok(self.0.ssl().pending())
346348
}

src/imp/schannel.rs

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -135,18 +135,20 @@ where
135135
}
136136
}
137137

138-
impl<S> MidHandshakeTlsStream<S>
139-
where
140-
S: io::Read + io::Write,
141-
{
138+
impl<S> MidHandshakeTlsStream<S> {
142139
pub fn get_ref(&self) -> &S {
143140
self.0.get_ref()
144141
}
145142

146143
pub fn get_mut(&mut self) -> &mut S {
147144
self.0.get_mut()
148145
}
146+
}
149147

148+
impl<S> MidHandshakeTlsStream<S>
149+
where
150+
S: io::Read + io::Write,
151+
{
150152
pub fn handshake(self) -> Result<TlsStream<S>, HandshakeError<S>> {
151153
match self.0.handshake() {
152154
Ok(s) => Ok(TlsStream(s)),
@@ -273,15 +275,17 @@ impl<S: fmt::Debug> fmt::Debug for TlsStream<S> {
273275
}
274276
}
275277

276-
impl<S: io::Read + io::Write> TlsStream<S> {
278+
impl<S> TlsStream<S> {
277279
pub fn get_ref(&self) -> &S {
278280
self.0.get_ref()
279281
}
280282

281283
pub fn get_mut(&mut self) -> &mut S {
282284
self.0.get_mut()
283285
}
286+
}
284287

288+
impl<S: io::Read + io::Write> TlsStream<S> {
285289
pub fn buffered_read_size(&self) -> Result<usize, Error> {
286290
Ok(self.0.get_buf().len())
287291
}

src/imp/security_framework.rs

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -218,10 +218,7 @@ where
218218
}
219219
}
220220

221-
impl<S> MidHandshakeTlsStream<S>
222-
where
223-
S: io::Read + io::Write,
224-
{
221+
impl<S> MidHandshakeTlsStream<S> {
225222
pub fn get_ref(&self) -> &S {
226223
match *self {
227224
MidHandshakeTlsStream::Server(ref s, _) => s.get_ref(),
@@ -235,7 +232,12 @@ where
235232
MidHandshakeTlsStream::Client(ref mut s) => s.get_mut(),
236233
}
237234
}
235+
}
238236

237+
impl<S> MidHandshakeTlsStream<S>
238+
where
239+
S: io::Read + io::Write,
240+
{
239241
pub fn handshake(self) -> Result<TlsStream<S>, HandshakeError<S>> {
240242
match self {
241243
MidHandshakeTlsStream::Server(s, cert) => match s.handshake() {
@@ -362,15 +364,17 @@ impl<S: fmt::Debug> fmt::Debug for TlsStream<S> {
362364
}
363365
}
364366

365-
impl<S: io::Read + io::Write> TlsStream<S> {
367+
impl<S> TlsStream<S> {
366368
pub fn get_ref(&self) -> &S {
367369
self.stream.get_ref()
368370
}
369371

370372
pub fn get_mut(&mut self) -> &mut S {
371373
self.stream.get_mut()
372374
}
375+
}
373376

377+
impl<S: io::Read + io::Write> TlsStream<S> {
374378
pub fn buffered_read_size(&self) -> Result<usize, Error> {
375379
Ok(self.stream.context().buffered_read_size()?)
376380
}

src/lib.rs

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -220,10 +220,7 @@ where
220220
}
221221
}
222222

223-
impl<S> MidHandshakeTlsStream<S>
224-
where
225-
S: io::Read + io::Write,
226-
{
223+
impl<S> MidHandshakeTlsStream<S> {
227224
/// Returns a shared reference to the inner stream.
228225
pub fn get_ref(&self) -> &S {
229226
self.0.get_ref()
@@ -233,7 +230,12 @@ where
233230
pub fn get_mut(&mut self) -> &mut S {
234231
self.0.get_mut()
235232
}
233+
}
236234

235+
impl<S> MidHandshakeTlsStream<S>
236+
where
237+
S: io::Read + io::Write,
238+
{
237239
/// Restarts the handshake process.
238240
///
239241
/// If the handshake completes successfully then the negotiated stream is
@@ -608,7 +610,7 @@ impl<S: fmt::Debug> fmt::Debug for TlsStream<S> {
608610
}
609611
}
610612

611-
impl<S: io::Read + io::Write> TlsStream<S> {
613+
impl<S> TlsStream<S> {
612614
/// Returns a shared reference to the inner stream.
613615
pub fn get_ref(&self) -> &S {
614616
self.0.get_ref()
@@ -618,7 +620,9 @@ impl<S: io::Read + io::Write> TlsStream<S> {
618620
pub fn get_mut(&mut self) -> &mut S {
619621
self.0.get_mut()
620622
}
623+
}
621624

625+
impl<S: io::Read + io::Write> TlsStream<S> {
622626
/// Returns the number of bytes that can be read without resulting in any
623627
/// network calls.
624628
pub fn buffered_read_size(&self) -> Result<usize> {

0 commit comments

Comments
 (0)