Skip to content

auto: libcore: Add @ to Readers #4790

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 9 additions & 9 deletions src/libcore/io.rs
Original file line number Diff line number Diff line change
Expand Up @@ -490,25 +490,25 @@ pub fn FILERes(f: *libc::FILE) -> FILERes {
}
}

pub fn FILE_reader(f: *libc::FILE, cleanup: bool) -> Reader {
pub fn FILE_reader(f: *libc::FILE, cleanup: bool) -> @Reader {
if cleanup {
Wrapper { base: f, cleanup: FILERes(f) } as Reader
@Wrapper { base: f, cleanup: FILERes(f) } as @Reader
} else {
f as Reader
@f as @Reader
}
}

// FIXME (#2004): this should either be an trait-less impl, a set of
// top-level functions that take a reader, or a set of default methods on
// reader (which can then be called reader)

pub fn stdin() -> Reader {
pub fn stdin() -> @Reader {
unsafe {
rustrt::rust_get_stdin() as Reader
rustrt::rust_get_stdin() as @Reader
}
}

pub fn file_reader(path: &Path) -> Result<Reader, ~str> {
pub fn file_reader(path: &Path) -> Result<@Reader, ~str> {
unsafe {
let f = os::as_c_charp(path.to_str(), |pathbuf| {
os::as_c_charp("r", |modebuf|
Expand Down Expand Up @@ -555,11 +555,11 @@ impl BytesReader: Reader {
fn tell(&self) -> uint { self.pos }
}

pub pure fn with_bytes_reader<t>(bytes: &[u8], f: fn(Reader) -> t) -> t {
f(BytesReader { bytes: bytes, pos: 0u } as Reader)
pub pure fn with_bytes_reader<t>(bytes: &[u8], f: fn(@Reader) -> t) -> t {
f(@BytesReader { bytes: bytes, pos: 0u } as @Reader)
}

pub pure fn with_str_reader<T>(s: &str, f: fn(Reader) -> T) -> T {
pub pure fn with_str_reader<T>(s: &str, f: fn(@Reader) -> T) -> T {
str::byte_slice(s, |bytes| with_bytes_reader(bytes, f))
}

Expand Down