mirror of
https://github.com/servo/servo.git
synced 2025-06-21 15:49:04 +01:00
14 lines
499 B
Rust
14 lines
499 B
Rust
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
|
|
|
use std::rt::io::{io_error, EndOfFile};
|
|
|
|
/// Ignore the end-of-file condition within a block of code.
|
|
pub fn ignoring_eof<U>(cb: &fn() -> U) -> U {
|
|
io_error::cond.trap(|e|
|
|
match e.kind {
|
|
EndOfFile => (),
|
|
_ => io_error::cond.raise(e)
|
|
}).inside(cb)
|
|
}
|