Add new GLib 0.14 variant types for metadata types

This way it's more convenient for downstream crates like ostree-rs-ext
to convert loaded variants.

TODO: Can we add a feature for the `gvariant` crate and expose via
that too?
This commit is contained in:
Colin Walters committed 2022-05-06 12:53:57 -04:00
1 parent 48e0d334b8
commit 83c829eaad
4 files changed
+38

No files matched your search

+13
View File
@@ -0,0 +1,13 @@
use crate::util::*;
use std::error::Error;
#[test]
fn variant_types() -> Result<(), Box<dyn Error>> {
let tr = TestRepo::new();
let commit_checksum = tr.test_commit("test");
let repo = &tr.repo;
let commit_v = repo.load_variant(ostree::ObjectType::Commit, commit_checksum.as_str())?;
let commit = commit_v.get::<ostree::CommitVariantType>().unwrap();
assert_eq!(commit.3, "Test Commit");
Ok(())
}