Automatic gtk::ListStore struct derive for Rust.
In order to use this crate, you have to add the following dependencies into
your project's Cargo.toml
file:
toml
[dependencies]
gtk_liststore_item = "0.1.0"
After this is done, you can enjoy the ListStoreItem derive!
```rust
struct Item { name: String, value: u32, }
fn main() { gtk::init().unwrap();
let list_store = ...; // Depends if you are using Glade or code for your UI
let item = Item { name: "foobar".into(), value: 42 };
item.insert_into_liststore(glade.list_store);
} ```
Without this crate, you would have to manually serialize each of the entries in your struct with their type:
```rust
fn getitem(liststore: gtk::ListStore, iter: >k::TreeIter) {
Some(Item {
name: liststore.getvalue(&iter, 0).get::
fn insertitem(item: &Item, liststore: gtk::ListStore) -> gtk::TreeIter { liststore.insertwith_values( None, &[0, 1], &[&self.name, &self.value]) } ```
This can become pretty boring, hence this crate to ease the process.
Licensed under either of Apache License, Version 2.0 or MIT license at your option.
Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in Serde by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.