Update Cargo script (change [[lib]] to [lib])
Fix build error
Remove build warnings
I changed this file's source code more rust-like (especially for functions' returned values)