我想将本地进程的标准输出流式传输到 Vert.x HttpResponse。
为此,我认为我必须将 a java.io.InputStream(将进程标准输出流式传输)流式传输/转换/管道传输到 an io.vertx.core.streams.ReadStream,然后我可以将其通过管道传输ReadStream到HttpResponse.
我正在寻找一种对内存影响较小的解决方案,因此读取内存中的整个标准输出然后将其刷新到 HttpResponse 是不可能的。
谢谢
我正在尝试在Rust写一个小程序,但我无法让它工作.
我在一个较小的脚本中重现了错误:
fn main() {
let name = String::from("World");
let test = simple(name);
println!("Hello {}!", test())
}
fn simple<T>(a: T) -> Box<Fn() -> T> {
Box::new(move || -> T {
a
})
}
Run Code Online (Sandbox Code Playgroud)
当我编译它时,我收到此错误:
error[E0310]: the parameter type `T` may not live long enough
--> test.rs:8:9
|
7 | fn simple<T>(a: T) -> Box<Fn() -> T> {
| - help: consider adding an explicit lifetime bound `T: 'static`...
8 | / Box::new(move || -> T {
9 | | a …Run Code Online (Sandbox Code Playgroud)