wasmtime-wasi 42.0.2

WASI implementation in Rust
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
use crate::p2::bindings::sockets::instance_network;
use crate::p2::network::Network;
use crate::sockets::WasiSocketsCtxView;
use wasmtime::component::Resource;

impl instance_network::Host for WasiSocketsCtxView<'_> {
    fn instance_network(&mut self) -> Result<Resource<Network>, wasmtime::Error> {
        let network = Network {
            socket_addr_check: self.ctx.socket_addr_check.clone(),
            allow_ip_name_lookup: self.ctx.allowed_network_uses.ip_name_lookup,
        };
        let network = self.table.push(network)?;
        Ok(network)
    }
}