libflo_func 0.1.1

A library for loading modules containing shared libs into libflo.
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
use error::*;
use libflo_module::{ file_from_path, text_from_file };
use serde_json;
use serialization::Dll;
use std::path::Path;

pub fn dll_from_path<TPath>(path: TPath) -> Result<Dll>
    where TPath: AsRef<Path> {
    let file = try!(file_from_path(path));
    let text = try!(text_from_file(file));
    dll_from_text(text)
}

pub fn dll_from_text(text: String) -> Result<Dll> {
    serde_json::from_str::<Dll>(&text)
        .map_err(|err| Error::from(ErrorKind::SerdeJsonError(err)))
        .chain_err(|| ErrorKind::DllDeserializationFailure(text))
}