Class: Wasmtime::WasiCtxBuilder
- Inherits:
-
Object
- Object
- Wasmtime::WasiCtxBuilder
- Defined in:
- ext/src/ruby_api/wasi_ctx_builder.rs
Overview
WASI context builder to be sent as Store.new’s wasi_ctx
keyword argument.
Instance methods mutate the current object and return self
.
Class Method Summary collapse
-
.new ⇒ WasiCtxBuilder
Create a new WasiCtxBuilder.
Instance Method Summary collapse
-
#inherit_stderr ⇒ WasiCtxBuilder
Inherit stderr from the current Ruby process.
-
#inherit_stdin ⇒ WasiCtxBuilder
Inherit stdin from the current Ruby process.
-
#inherit_stdout ⇒ WasiCtxBuilder
Inherit stdout from the current Ruby process.
-
#set_argv(args) ⇒ WasiCtxBuilder
Set the arguments (argv) to the specified
Array
. -
#set_env(env) ⇒ WasiCtxBuilder
Set env to the specified
Hash
. -
#set_stderr_file(path) ⇒ WasiCtxBuilder
Set stderr to write to a file.
-
#set_stdin_file(path) ⇒ WasiCtxBuilder
Set stdin to read from the specified file.
-
#set_stdin_string(content) ⇒ WasiCtxBuilder
Set stdin to the specified String.
-
#set_stdout_file(path) ⇒ WasiCtxBuilder
Set stdout to write to a file.
Class Method Details
.new ⇒ WasiCtxBuilder
Create a new Wasmtime::WasiCtxBuilder. By default, it has nothing: no stdin/out/err, no env, no argv, no file access.
96 97 98 |
# File 'ext/src/ruby_api/wasi_ctx_builder.rs', line 96
pub fn new() -> Self {
Self::default()
}
|
Instance Method Details
#inherit_stderr ⇒ WasiCtxBuilder
Inherit stderr from the current Ruby process.
155 156 157 158 159 |
# File 'ext/src/ruby_api/wasi_ctx_builder.rs', line 155
pub fn inherit_stderr(rb_self: RbSelf) -> RbSelf {
let mut inner = rb_self.get().inner.borrow_mut();
inner.stderr = Some(WriteStream::Inherit);
rb_self
}
|
#inherit_stdin ⇒ WasiCtxBuilder
Inherit stdin from the current Ruby process.
103 104 105 106 107 |
# File 'ext/src/ruby_api/wasi_ctx_builder.rs', line 103
pub fn inherit_stdin(rb_self: RbSelf) -> RbSelf {
let mut inner = rb_self.get().inner.borrow_mut();
inner.stdin = Some(ReadStream::Inherit);
rb_self
}
|
#inherit_stdout ⇒ WasiCtxBuilder
Inherit stdout from the current Ruby process.
134 135 136 137 138 |
# File 'ext/src/ruby_api/wasi_ctx_builder.rs', line 134
pub fn inherit_stdout(rb_self: RbSelf) -> RbSelf {
let mut inner = rb_self.get().inner.borrow_mut();
inner.stdout = Some(WriteStream::Inherit);
rb_self
}
|
#set_argv(args) ⇒ WasiCtxBuilder
Set the arguments (argv) to the specified Array
.
189 190 191 192 193 |
# File 'ext/src/ruby_api/wasi_ctx_builder.rs', line 189
pub fn set_argv(rb_self: RbSelf, argv: RArray) -> RbSelf {
let mut inner = rb_self.get().inner.borrow_mut();
inner.args = Some(argv);
rb_self
}
|
#set_env(env) ⇒ WasiCtxBuilder
Set env to the specified Hash
.
178 179 180 181 182 |
# File 'ext/src/ruby_api/wasi_ctx_builder.rs', line 178
pub fn set_env(rb_self: RbSelf, env: RHash) -> RbSelf {
let mut inner = rb_self.get().inner.borrow_mut();
inner.env = Some(env);
rb_self
}
|
#set_stderr_file(path) ⇒ WasiCtxBuilder
Set stderr to write to a file. Will truncate the file if it exists, otherwise try to create it.
167 168 169 170 171 |
# File 'ext/src/ruby_api/wasi_ctx_builder.rs', line 167
pub fn set_stderr_file(rb_self: RbSelf, path: RString) -> RbSelf {
let mut inner = rb_self.get().inner.borrow_mut();
inner.stderr = Some(WriteStream::Path(path));
rb_self
}
|
#set_stdin_file(path) ⇒ WasiCtxBuilder
Set stdin to read from the specified file.
114 115 116 117 118 |
# File 'ext/src/ruby_api/wasi_ctx_builder.rs', line 114
pub fn set_stdin_file(rb_self: RbSelf, path: RString) -> RbSelf {
let mut inner = rb_self.get().inner.borrow_mut();
inner.stdin = Some(ReadStream::Path(path));
rb_self
}
|
#set_stdin_string(content) ⇒ WasiCtxBuilder
Set stdin to the specified String.
125 126 127 128 129 |
# File 'ext/src/ruby_api/wasi_ctx_builder.rs', line 125
pub fn set_stdin_string(rb_self: RbSelf, content: RString) -> RbSelf {
let mut inner = rb_self.get().inner.borrow_mut();
inner.stdin = Some(ReadStream::String(content));
rb_self
}
|
#set_stdout_file(path) ⇒ WasiCtxBuilder
Set stdout to write to a file. Will truncate the file if it exists, otherwise try to create it.
146 147 148 149 150 |
# File 'ext/src/ruby_api/wasi_ctx_builder.rs', line 146
pub fn set_stdout_file(rb_self: RbSelf, path: RString) -> RbSelf {
let mut inner = rb_self.get().inner.borrow_mut();
inner.stdout = Some(WriteStream::Path(path));
rb_self
}
|