daa84 / neovim-lib

Rust library for Neovim clients
GNU Lesser General Public License v3.0
192 stars 26 forks source link

scorched earth: a useless neovim plugin in rust #5

Open boxofrox opened 7 years ago

boxofrox commented 7 years ago

Here's my first completely useless neovim plugin[1] in Rust! I've been using it to test/dictate the design choices in my patches for neovim-lib. It relies on PR #4 and another yet-to-be PR currently in my fork of neovim-lib.

One thing this project brought to light is argument parsing. I wrote a couple functions to extract usize and String from neovim_lib::rpc::Value[2], and I see src/rpc/model.rs defines a couple macros along the same lines. I think it would be worthwhile for neovim_lib to expose this functionality.

Anyway, wanted to submit this for review as a working example and possible template for other plugins.

Cheers!

[1]: https://github.com/boxofrox/neovim-scorched-earth

[2]: https://github.com/boxofrox/neovim-scorched-earth/blob/master/src/args.rs

daa84 commented 7 years ago

Hello! Thanks for your project.

About unwrap Value - i have plan to move back to rmpv library Value, Value in this library have methods for extracting simple values, for example as_u64 rmp::Value, together with From converters. Will it solve this issue?

boxofrox commented 7 years ago

@daa84 yes, I think that will take care of parsing.