Skip to content

Commit

Permalink
Merge #490
Browse files Browse the repository at this point in the history
490: Add MiddlewareChain and StreamingCompiler to runtime r=syrusakbary a=bjfish

It would be nice to add `MiddlewareChain` and `StreamingCompiler` to runtime to be able to use these without having to include the `runtime-core` as a dependency. For example:
```rust
use wasmer_runtime::{MiddlewareChain, StreamingCompiler};
use wasmer_singlepass_backend::ModuleCodeGenerator as SinglePassMCG;
use wasmer_middleware_common::metering::Metering;
let limit = 1_000_000;
let c: StreamingCompiler<SinglePassMCG, _, _, _, _> = StreamingCompiler::new(move || {
    let mut chain = MiddlewareChain::new();
    chain.push(Metering::new(limit));
    chain
});            
wasmer_runtime::compile_with(&prepared_code, &c)
    .map_err(|e| Error::Wasmer(format!("{}", e)))
            chain
        });            
wasmer_runtime::compile_with(&prepared_code, &c)
    .map_err(|e| Error::Wasmer(format!("{}", e)))
```

Co-authored-by: Brandon Fish <[email protected]>
  • Loading branch information
bors[bot] and bjfish committed Jun 10, 2019
2 parents bea3ebd + c678647 commit 1948ad5
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions lib/runtime/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@
//! [`wasmer-clif-backend`]: https://crates.io/crates/wasmer-clif-backend
//! [`compile_with`]: fn.compile_with.html
pub use wasmer_runtime_core::codegen::{MiddlewareChain, StreamingCompiler};
pub use wasmer_runtime_core::export::Export;
pub use wasmer_runtime_core::global::Global;
pub use wasmer_runtime_core::import::ImportObject;
Expand Down

0 comments on commit 1948ad5

Please sign in to comment.