This repository was archived by the owner on May 28, 2025. It is now read-only.
Commit 5547101
authored
Rollup merge of rust-lang#108094 - kornelski:fsdocs, r=cuviper
Demonstrate I/O in File examples
I've noticed that some Rust novices unnecessarily reinvent `std::fs::{read,write}`, presumably because they search for equivalents of `fopen` + `fwrite`. I've added links to `std::fs::{read,write}` in the docs.
The `File` examples were only showing how to open a file, but not how to use the opened handle, unnecessarily leaving out the next step. I've added a variety of different uses of file handles to their examples in docs.1 file changed
+19
-1
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
334 | 334 | | |
335 | 335 | | |
336 | 336 | | |
| 337 | + | |
| 338 | + | |
| 339 | + | |
| 340 | + | |
337 | 341 | | |
338 | 342 | | |
339 | 343 | | |
| |||
343 | 347 | | |
344 | 348 | | |
345 | 349 | | |
| 350 | + | |
346 | 351 | | |
347 | 352 | | |
348 | 353 | | |
| 354 | + | |
| 355 | + | |
349 | 356 | | |
350 | 357 | | |
351 | 358 | | |
| |||
361 | 368 | | |
362 | 369 | | |
363 | 370 | | |
364 | | - | |
365 | 371 | | |
366 | 372 | | |
| 373 | + | |
| 374 | + | |
| 375 | + | |
367 | 376 | | |
368 | 377 | | |
369 | 378 | | |
370 | 379 | | |
| 380 | + | |
371 | 381 | | |
372 | 382 | | |
373 | 383 | | |
| 384 | + | |
374 | 385 | | |
375 | 386 | | |
376 | 387 | | |
| |||
397 | 408 | | |
398 | 409 | | |
399 | 410 | | |
| 411 | + | |
400 | 412 | | |
401 | 413 | | |
402 | 414 | | |
| 415 | + | |
403 | 416 | | |
404 | 417 | | |
405 | 418 | | |
| |||
426 | 439 | | |
427 | 440 | | |
428 | 441 | | |
| 442 | + | |
429 | 443 | | |
430 | 444 | | |
431 | 445 | | |
| 446 | + | |
432 | 447 | | |
433 | 448 | | |
434 | 449 | | |
| |||
966 | 981 | | |
967 | 982 | | |
968 | 983 | | |
| 984 | + | |
| 985 | + | |
| 986 | + | |
969 | 987 | | |
970 | 988 | | |
971 | 989 | | |
| |||
0 commit comments