result_unit_probe
fn result_unit_probe(int n) -> Result<unit, IoError> Import
Source: use io::{result_unit_probe}; compiler/src/builtin_docs/io.hy Returns Ok(()) when n >= 0 and Err(IoError::InvalidInput) otherwise.
A small host function for testing how Result<unit, IoError> values
cross between the runtime and Coil code; it does no IO.
Parameters#
| Name | Type |
|---|---|
n | int |
Returns#
Result<unit, IoError>
Examples#
use io::{result_unit_probe, IoError};
use tests::assert;
let ok = match result_unit_probe(1) {
Result::Ok(_) => true,
Result::Err(_) => false,
};
let err = match result_unit_probe(-1) {
Result::Err(IoError::InvalidInput) => true,
default => false,
};
assert!(ok && err);
See also#
Resultstdin: Returns a new stream on the process’s standard input.stdout: Returns a new stream on the process’s standard output.stderr: Returns a new stream on the process’s standard error.capture_begin: Starts keeping this thread’s stdout and stderr writes in memory instead of writing them, until the matchingcapture_end().capture_end: Ends the innermostcapture_begin()and returns what it kept, as(stdout, stderr).open: Opens the file atpathwithmodeand returns a stream on it.close: Closess.