@@ -146,6 +146,7 @@ impl SocketAddr {
146
146
/// let socket = UnixListener::bind("/tmp/sock")?;
147
147
/// let addr = socket.local_addr().expect("Couldn't get local address");
148
148
/// assert_eq!(addr.is_unnamed(), false);
149
+ /// Ok(())
149
150
/// }
150
151
/// ```
151
152
///
@@ -158,6 +159,7 @@ impl SocketAddr {
158
159
/// let socket = UnixDatagram::unbound()?;
159
160
/// let addr = socket.local_addr().expect("Couldn't get local address");
160
161
/// assert_eq!(addr.is_unnamed(), true);
162
+ /// Ok(())
161
163
/// }
162
164
/// ```
163
165
#[ stable( feature = "unix_socket" , since = "1.10.0" ) ]
@@ -183,6 +185,7 @@ impl SocketAddr {
183
185
/// let socket = UnixListener::bind("/tmp/sock")?;
184
186
/// let addr = socket.local_addr().expect("Couldn't get local address");
185
187
/// assert_eq!(addr.as_pathname(), Some(Path::new("/tmp/sock")));
188
+ /// Ok(())
186
189
/// }
187
190
/// ```
188
191
///
@@ -195,6 +198,7 @@ impl SocketAddr {
195
198
/// let socket = UnixDatagram::unbound()?;
196
199
/// let addr = socket.local_addr().expect("Couldn't get local address");
197
200
/// assert_eq!(addr.as_pathname(), None);
201
+ /// Ok(())
198
202
/// }
199
203
/// ```
200
204
#[ stable( feature = "unix_socket" , since = "1.10.0" ) ]
@@ -261,6 +265,7 @@ impl<'a> fmt::Display for AsciiEscaped<'a> {
261
265
/// let mut response = String::new();
262
266
/// stream.read_to_string(&mut response)?;
263
267
/// println!("{}", response);
268
+ /// Ok(())
264
269
/// }
265
270
/// ```
266
271
#[ stable( feature = "unix_socket" , since = "1.10.0" ) ]
@@ -349,6 +354,7 @@ impl UnixStream {
349
354
/// fn main() -> std::io::Result<()> {
350
355
/// let socket = UnixStream::connect("/tmp/sock")?;
351
356
/// let sock_copy = socket.try_clone().expect("Couldn't clone socket");
357
+ /// Ok(())
352
358
/// }
353
359
/// ```
354
360
#[ stable( feature = "unix_socket" , since = "1.10.0" ) ]
@@ -366,6 +372,7 @@ impl UnixStream {
366
372
/// fn main() -> std::io::Result<()> {
367
373
/// let socket = UnixStream::connect("/tmp/sock")?;
368
374
/// let addr = socket.local_addr().expect("Couldn't get local address");
375
+ /// Ok(())
369
376
/// }
370
377
/// ```
371
378
#[ stable( feature = "unix_socket" , since = "1.10.0" ) ]
@@ -383,6 +390,7 @@ impl UnixStream {
383
390
/// fn main() -> std::io::Result<()> {
384
391
/// let socket = UnixStream::connect("/tmp/sock")?;
385
392
/// let addr = socket.peer_addr().expect("Couldn't get peer address");
393
+ /// Ok(())
386
394
/// }
387
395
/// ```
388
396
#[ stable( feature = "unix_socket" , since = "1.10.0" ) ]
@@ -424,6 +432,7 @@ impl UnixStream {
424
432
/// let result = socket.set_read_timeout(Some(Duration::new(0, 0)));
425
433
/// let err = result.unwrap_err();
426
434
/// assert_eq!(err.kind(), io::ErrorKind::InvalidInput)
435
+ /// Ok(())
427
436
/// }
428
437
/// ```
429
438
#[ stable( feature = "unix_socket" , since = "1.10.0" ) ]
@@ -452,6 +461,7 @@ impl UnixStream {
452
461
/// let socket = UnixStream::connect("/tmp/sock")?;
453
462
/// socket.set_write_timeout(Some(Duration::new(1, 0)))
454
463
/// .expect("Couldn't set write timeout");
464
+ /// Ok(())
455
465
/// }
456
466
/// ```
457
467
///
@@ -468,6 +478,7 @@ impl UnixStream {
468
478
/// let result = socket.set_write_timeout(Some(Duration::new(0, 0)));
469
479
/// let err = result.unwrap_err();
470
480
/// assert_eq!(err.kind(), io::ErrorKind::InvalidInput)
481
+ /// Ok(())
471
482
/// }
472
483
/// ```
473
484
#[ stable( feature = "unix_socket" , since = "1.10.0" ) ]
@@ -487,6 +498,7 @@ impl UnixStream {
487
498
/// let socket = UnixStream::connect("/tmp/sock")?;
488
499
/// socket.set_read_timeout(Some(Duration::new(1, 0))).expect("Couldn't set read timeout");
489
500
/// assert_eq!(socket.read_timeout()?, Some(Duration::new(1, 0)));
501
+ /// Ok(())
490
502
/// }
491
503
/// ```
492
504
#[ stable( feature = "unix_socket" , since = "1.10.0" ) ]
@@ -507,6 +519,7 @@ impl UnixStream {
507
519
/// socket.set_write_timeout(Some(Duration::new(1, 0)))
508
520
/// .expect("Couldn't set write timeout");
509
521
/// assert_eq!(socket.write_timeout()?, Some(Duration::new(1, 0)));
522
+ /// Ok(())
510
523
/// }
511
524
/// ```
512
525
#[ stable( feature = "unix_socket" , since = "1.10.0" ) ]
@@ -524,6 +537,7 @@ impl UnixStream {
524
537
/// fn main() -> std::io::Result<()> {
525
538
/// let socket = UnixStream::connect("/tmp/sock")?;
526
539
/// socket.set_nonblocking(true).expect("Couldn't set nonblocking");
540
+ /// Ok(())
527
541
/// }
528
542
/// ```
529
543
#[ stable( feature = "unix_socket" , since = "1.10.0" ) ]
@@ -543,6 +557,7 @@ impl UnixStream {
543
557
/// if let Ok(Some(err)) = socket.take_error() {
544
558
/// println!("Got error: {:?}", err);
545
559
/// }
560
+ /// Ok(())
546
561
/// }
547
562
/// ```
548
563
///
@@ -570,6 +585,7 @@ impl UnixStream {
570
585
/// fn main() -> std::io::Result<()> {
571
586
/// let socket = UnixStream::connect("/tmp/sock");
572
587
/// socket.shutdown(Shutdown::Both).expect("shutdown function failed");
588
+ /// Ok(())
573
589
/// }
574
590
/// ```
575
591
#[ stable( feature = "unix_socket" , since = "1.10.0" ) ]
@@ -747,6 +763,7 @@ impl IntoRawFd for net::UdpSocket {
747
763
/// }
748
764
/// }
749
765
/// }
766
+ /// Ok(())
750
767
/// }
751
768
/// ```
752
769
#[ stable( feature = "unix_socket" , since = "1.10.0" ) ]
@@ -816,6 +833,7 @@ impl UnixListener {
816
833
/// Ok((socket, addr)) => println!("Got a client: {:?}", addr),
817
834
/// Err(e) => println!("accept function failed: {:?}", e),
818
835
/// }
836
+ /// Ok(())
819
837
/// }
820
838
/// ```
821
839
#[ stable( feature = "unix_socket" , since = "1.10.0" ) ]
@@ -840,8 +858,8 @@ impl UnixListener {
840
858
///
841
859
/// fn main() -> std::io::Result<()> {
842
860
/// let listener = UnixListener::bind("/path/to/the/socket")?;
843
- ///
844
861
/// let listener_copy = listener.try_clone().expect("try_clone failed");
862
+ /// Ok(())
845
863
/// }
846
864
/// ```
847
865
#[ stable( feature = "unix_socket" , since = "1.10.0" ) ]
@@ -858,8 +876,8 @@ impl UnixListener {
858
876
///
859
877
/// fn main() -> std::io::Result<()> {
860
878
/// let listener = UnixListener::bind("/path/to/the/socket")?;
861
- ///
862
879
/// let addr = listener.local_addr().expect("Couldn't get local address");
880
+ /// Ok(())
863
881
/// }
864
882
/// ```
865
883
#[ stable( feature = "unix_socket" , since = "1.10.0" ) ]
@@ -876,8 +894,8 @@ impl UnixListener {
876
894
///
877
895
/// fn main() -> std::io::Result<()> {
878
896
/// let listener = UnixListener::bind("/path/to/the/socket")?;
879
- ///
880
897
/// listener.set_nonblocking(true).expect("Couldn't set non blocking");
898
+ /// Ok(())
881
899
/// }
882
900
/// ```
883
901
#[ stable( feature = "unix_socket" , since = "1.10.0" ) ]
@@ -898,6 +916,7 @@ impl UnixListener {
898
916
/// if let Ok(Some(err)) = listener.take_error() {
899
917
/// println!("Got error: {:?}", err);
900
918
/// }
919
+ /// Ok(())
901
920
/// }
902
921
/// ```
903
922
///
@@ -939,6 +958,7 @@ impl UnixListener {
939
958
/// }
940
959
/// }
941
960
/// }
961
+ /// Ok(())
942
962
/// }
943
963
/// ```
944
964
#[ stable( feature = "unix_socket" , since = "1.10.0" ) ]
@@ -1008,6 +1028,7 @@ impl<'a> IntoIterator for &'a UnixListener {
1008
1028
/// }
1009
1029
/// }
1010
1030
/// }
1031
+ /// Ok(())
1011
1032
/// }
1012
1033
/// ```
1013
1034
#[ derive( Debug ) ]
@@ -1042,6 +1063,7 @@ impl<'a> Iterator for Incoming<'a> {
1042
1063
/// let mut buf = [0; 100];
1043
1064
/// let (count, address) = socket.recv_from(&mut buf)?;
1044
1065
/// println!("socket {:?} sent {:?}", address, &buf[..count]);
1066
+ /// Ok(())
1045
1067
/// }
1046
1068
/// ```
1047
1069
#[ stable( feature = "unix_socket" , since = "1.10.0" ) ]
@@ -1157,9 +1179,10 @@ impl UnixDatagram {
1157
1179
/// Ok(sock) => sock,
1158
1180
/// Err(e) => {
1159
1181
/// println!("Couldn't connect: {:?}", e);
1160
- /// return
1182
+ /// return Err(e)
1161
1183
/// }
1162
1184
/// };
1185
+ /// Ok(())
1163
1186
/// }
1164
1187
/// ```
1165
1188
#[ stable( feature = "unix_socket" , since = "1.10.0" ) ]
@@ -1189,8 +1212,8 @@ impl UnixDatagram {
1189
1212
///
1190
1213
/// fn main() -> std::io::Result<()> {
1191
1214
/// let sock = UnixDatagram::bind("/path/to/the/socket")?;
1192
- ///
1193
1215
/// let sock_copy = sock.try_clone().expect("try_clone failed");
1216
+ /// Ok(())
1194
1217
/// }
1195
1218
/// ```
1196
1219
#[ stable( feature = "unix_socket" , since = "1.10.0" ) ]
@@ -1207,8 +1230,8 @@ impl UnixDatagram {
1207
1230
///
1208
1231
/// fn main() -> std::io::Result<()> {
1209
1232
/// let sock = UnixDatagram::bind("/path/to/the/socket")?;
1210
- ///
1211
1233
/// let addr = sock.local_addr().expect("Couldn't get local address");
1234
+ /// Ok(())
1212
1235
/// }
1213
1236
/// ```
1214
1237
#[ stable( feature = "unix_socket" , since = "1.10.0" ) ]
@@ -1232,6 +1255,7 @@ impl UnixDatagram {
1232
1255
/// sock.connect("/path/to/the/socket")?;
1233
1256
///
1234
1257
/// let addr = sock.peer_addr().expect("Couldn't get peer address");
1258
+ /// Ok(())
1235
1259
/// }
1236
1260
/// ```
1237
1261
#[ stable( feature = "unix_socket" , since = "1.10.0" ) ]
@@ -1252,10 +1276,9 @@ impl UnixDatagram {
1252
1276
/// fn main() -> std::io::Result<()> {
1253
1277
/// let sock = UnixDatagram::unbound()?;
1254
1278
/// let mut buf = vec![0; 10];
1255
- /// match sock.recv_from(buf.as_mut_slice()) {
1256
- /// Ok((size, sender)) => println!("received {} bytes from {:?}", size, sender),
1257
- /// Err(e) => println!("recv_from function failed: {:?}", e),
1258
- /// }
1279
+ /// let (size, sender) = sock.recv_from(buf.as_mut_slice())?;
1280
+ /// println!("received {} bytes from {:?}", size, sender);
1281
+ /// Ok(())
1259
1282
/// }
1260
1283
/// ```
1261
1284
#[ stable( feature = "unix_socket" , since = "1.10.0" ) ]
@@ -1295,6 +1318,7 @@ impl UnixDatagram {
1295
1318
/// let sock = UnixDatagram::bind("/path/to/the/socket")?;
1296
1319
/// let mut buf = vec![0; 10];
1297
1320
/// sock.recv(buf.as_mut_slice()).expect("recv function failed");
1321
+ /// Ok(())
1298
1322
/// }
1299
1323
/// ```
1300
1324
#[ stable( feature = "unix_socket" , since = "1.10.0" ) ]
@@ -1314,6 +1338,7 @@ impl UnixDatagram {
1314
1338
/// fn main() -> std::io::Result<()> {
1315
1339
/// let sock = UnixDatagram::unbound()?;
1316
1340
/// sock.send_to(b"omelette au fromage", "/some/sock").expect("send_to function failed");
1341
+ /// Ok(())
1317
1342
/// }
1318
1343
/// ```
1319
1344
#[ stable( feature = "unix_socket" , since = "1.10.0" ) ]
@@ -1350,6 +1375,7 @@ impl UnixDatagram {
1350
1375
/// let sock = UnixDatagram::unbound()?;
1351
1376
/// sock.connect("/some/sock").expect("Couldn't connect");
1352
1377
/// sock.send(b"omelette au fromage").expect("send_to function failed");
1378
+ /// Ok(())
1353
1379
/// }
1354
1380
/// ```
1355
1381
#[ stable( feature = "unix_socket" , since = "1.10.0" ) ]
@@ -1379,6 +1405,7 @@ impl UnixDatagram {
1379
1405
/// let sock = UnixDatagram::unbound()?;
1380
1406
/// sock.set_read_timeout(Some(Duration::new(1, 0)))
1381
1407
/// .expect("set_read_timeout function failed");
1408
+ /// Ok(())
1382
1409
/// }
1383
1410
/// ```
1384
1411
///
@@ -1395,6 +1422,7 @@ impl UnixDatagram {
1395
1422
/// let result = socket.set_read_timeout(Some(Duration::new(0, 0)));
1396
1423
/// let err = result.unwrap_err();
1397
1424
/// assert_eq!(err.kind(), io::ErrorKind::InvalidInput)
1425
+ /// Ok(())
1398
1426
/// }
1399
1427
/// ```
1400
1428
#[ stable( feature = "unix_socket" , since = "1.10.0" ) ]
@@ -1423,6 +1451,7 @@ impl UnixDatagram {
1423
1451
/// let sock = UnixDatagram::unbound()?;
1424
1452
/// sock.set_write_timeout(Some(Duration::new(1, 0)))
1425
1453
/// .expect("set_write_timeout function failed");
1454
+ /// Ok(())
1426
1455
/// }
1427
1456
/// ```
1428
1457
///
@@ -1439,6 +1468,7 @@ impl UnixDatagram {
1439
1468
/// let result = socket.set_write_timeout(Some(Duration::new(0, 0)));
1440
1469
/// let err = result.unwrap_err();
1441
1470
/// assert_eq!(err.kind(), io::ErrorKind::InvalidInput)
1471
+ /// Ok(())
1442
1472
/// }
1443
1473
/// ```
1444
1474
#[ stable( feature = "unix_socket" , since = "1.10.0" ) ]
@@ -1459,6 +1489,7 @@ impl UnixDatagram {
1459
1489
/// sock.set_read_timeout(Some(Duration::new(1, 0)))
1460
1490
/// .expect("set_read_timeout function failed");
1461
1491
/// assert_eq!(sock.read_timeout()?, Some(Duration::new(1, 0)));
1492
+ /// Ok(())
1462
1493
/// }
1463
1494
/// ```
1464
1495
#[ stable( feature = "unix_socket" , since = "1.10.0" ) ]
@@ -1479,6 +1510,7 @@ impl UnixDatagram {
1479
1510
/// sock.set_write_timeout(Some(Duration::new(1, 0)))
1480
1511
/// .expect("set_write_timeout function failed");
1481
1512
/// assert_eq!(sock.write_timeout()?, Some(Duration::new(1, 0)));
1513
+ /// Ok(())
1482
1514
/// }
1483
1515
/// ```
1484
1516
#[ stable( feature = "unix_socket" , since = "1.10.0" ) ]
@@ -1496,6 +1528,7 @@ impl UnixDatagram {
1496
1528
/// fn main() -> std::io::Result<()> {
1497
1529
/// let sock = UnixDatagram::unbound()?;
1498
1530
/// sock.set_nonblocking(true).expect("set_nonblocking function failed");
1531
+ /// Ok(())
1499
1532
/// }
1500
1533
/// ```
1501
1534
#[ stable( feature = "unix_socket" , since = "1.10.0" ) ]
@@ -1515,6 +1548,7 @@ impl UnixDatagram {
1515
1548
/// if let Ok(Some(err)) = sock.take_error() {
1516
1549
/// println!("Got error: {:?}", err);
1517
1550
/// }
1551
+ /// Ok(())
1518
1552
/// }
1519
1553
/// ```
1520
1554
#[ stable( feature = "unix_socket" , since = "1.10.0" ) ]
@@ -1537,6 +1571,7 @@ impl UnixDatagram {
1537
1571
/// fn main() -> std::io::Result<()> {
1538
1572
/// let sock = UnixDatagram::unbound()?;
1539
1573
/// sock.shutdown(Shutdown::Both).expect("shutdown function failed");
1574
+ /// Ok(())
1540
1575
/// }
1541
1576
/// ```
1542
1577
#[ stable( feature = "unix_socket" , since = "1.10.0" ) ]
0 commit comments