Skip to content

Commit c67267c

Browse files
committed
Move BorrowedBuf and BorrowedCursor from std:io to core::io
1 parent 7adc89b commit c67267c

File tree

7 files changed

+24
-16
lines changed

7 files changed

+24
-16
lines changed

library/std/src/io/readbuf.rs library/core/src/io/borrowed_buf.rs

+1-14
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,9 @@
1-
#![unstable(feature = "read_buf", issue = "78485")]
1+
#![unstable(feature = "core_io", issue = "117693")]
22

33
#[cfg(test)]
44
mod tests;
55

66
use crate::fmt::{self, Debug, Formatter};
7-
use crate::io::{Result, Write};
87
use crate::mem::{self, MaybeUninit};
98
use crate::{cmp, ptr};
109

@@ -303,15 +302,3 @@ impl<'a> BorrowedCursor<'a> {
303302
self.buf.filled += buf.len();
304303
}
305304
}
306-
307-
impl<'a> Write for BorrowedCursor<'a> {
308-
fn write(&mut self, buf: &[u8]) -> Result<usize> {
309-
self.append(buf);
310-
Ok(buf.len())
311-
}
312-
313-
#[inline]
314-
fn flush(&mut self) -> Result<()> {
315-
Ok(())
316-
}
317-
}
File renamed without changes.

library/core/src/io/mod.rs

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
//! Traits, helpers, and type definitions for core I/O functionality.
2+
3+
mod borrowed_buf;
4+
5+
#[unstable(feature = "core_io", issue = "117693")]
6+
pub use self::borrowed_buf::{BorrowedBuf, BorrowedCursor};

library/core/src/lib.rs

+2
Original file line numberDiff line numberDiff line change
@@ -370,6 +370,8 @@ pub mod cell;
370370
pub mod char;
371371
pub mod ffi;
372372
pub mod iter;
373+
#[unstable(feature = "core_io", issue = "117693")]
374+
pub mod io;
373375
pub mod net;
374376
pub mod option;
375377
pub mod panic;

library/std/src/io/impls.rs

+13
Original file line numberDiff line numberDiff line change
@@ -528,3 +528,16 @@ impl<A: Allocator> Write for VecDeque<u8, A> {
528528
Ok(())
529529
}
530530
}
531+
532+
#[unstable(feature = "read_buf", issue = "78485")]
533+
impl<'a> io::Write for core::io::BorrowedCursor<'a> {
534+
fn write(&mut self, buf: &[u8]) -> io::Result<usize> {
535+
self.append(buf);
536+
Ok(buf.len())
537+
}
538+
539+
#[inline]
540+
fn flush(&mut self) -> io::Result<()> {
541+
Ok(())
542+
}
543+
}

library/std/src/io/mod.rs

+1-2
Original file line numberDiff line numberDiff line change
@@ -330,7 +330,7 @@ pub use self::{
330330
};
331331

332332
#[unstable(feature = "read_buf", issue = "78485")]
333-
pub use self::readbuf::{BorrowedBuf, BorrowedCursor};
333+
pub use core::io::{BorrowedBuf, BorrowedCursor};
334334
pub(crate) use error::const_io_error;
335335

336336
mod buffered;
@@ -339,7 +339,6 @@ mod cursor;
339339
mod error;
340340
mod impls;
341341
pub mod prelude;
342-
mod readbuf;
343342
mod stdio;
344343
mod util;
345344

library/std/src/lib.rs

+1
Original file line numberDiff line numberDiff line change
@@ -310,6 +310,7 @@
310310
// tidy-alphabetical-start
311311
#![feature(char_internals)]
312312
#![feature(core_intrinsics)]
313+
#![feature(core_io)]
313314
#![feature(duration_constants)]
314315
#![feature(error_generic_member_access)]
315316
#![feature(error_in_core)]

0 commit comments

Comments
 (0)