Crate nozzle_bindings[][src]

Expand description

This crate provides access to the kronosnet libraries libknet and libnozzle from Rust. They are a fairly thin layer around the actual API calls but with Rust data types and iterators.

No more information about knet itself will be provided here, it is expected that if you feel you need access to the knet API calls, you know what they do :)


use nozzle_bindings::nozzle_bindings as nozzle; use std::io::{Result}; use std::env; use std::{thread, time};

fn main() -> Result<()> { let mut nozzle_name = String::from(“rustnoz”); let handle = match nozzle::open(&mut nozzle_name, &String::from(env::current_dir().unwrap().to_str().unwrap())) { Ok(h) => { println!(“Opened device {}”, nozzle_name); h }, Err(e) => { println!(“Error from open: {}”, e); return Err(e); } };

let if Err(e) = nozzle::add_ip(handle, &"".to_string(), &"24".to_string()) {
    println!("Error from add_ip: {}", e);
    return Err(e);

let if Err(e) = nozzle::set_mtu(handle, 157) {
    println!("Error from set_mtu: {}", e);
    return Err(e);