mirror of
https://github.com/ostreedev/ostree.git
synced 2025-02-27 01:57:49 +03:00
Add additional 'new' method to Repo
This commit is contained in:
parent
449899b16f
commit
62f8310dea
@ -13,6 +13,10 @@ use glib::Error;
|
||||
mod auto;
|
||||
pub use auto::*;
|
||||
|
||||
mod repo;
|
||||
|
||||
// public modules
|
||||
pub mod prelude;
|
||||
pub use prelude::*;
|
||||
pub mod prelude {
|
||||
pub use auto::traits::*;
|
||||
pub use repo::RepoExtManual;
|
||||
}
|
||||
|
@ -1 +0,0 @@
|
||||
pub use traits::*;
|
15
rust-bindings/rust/libostree/src/repo.rs
Normal file
15
rust-bindings/rust/libostree/src/repo.rs
Normal file
@ -0,0 +1,15 @@
|
||||
use auto::Repo;
|
||||
|
||||
use gio;
|
||||
use glib;
|
||||
use glib::IsA;
|
||||
|
||||
pub trait RepoExtManual {
|
||||
fn new_for_str(path: &str) -> Repo;
|
||||
}
|
||||
|
||||
impl<O: IsA<Repo> + IsA<glib::Object> + Clone + 'static> RepoExtManual for O {
|
||||
fn new_for_str(path: &str) -> Repo {
|
||||
Repo::new(&gio::File::new_for_path(path))
|
||||
}
|
||||
}
|
@ -1,16 +1,11 @@
|
||||
extern crate gio;
|
||||
extern crate libostree;
|
||||
|
||||
use gio::prelude::*;
|
||||
use libostree::prelude::*;
|
||||
|
||||
fn main() {
|
||||
let repo = libostree::Repo::new(&gio::File::new_for_path("test-repo"));
|
||||
let repo = libostree::Repo::new_for_str("test-repo");
|
||||
|
||||
let result = repo.create(libostree::RepoMode::Archive, Option::None);
|
||||
|
||||
result.expect("we did not expect this to fail :O");
|
||||
|
||||
let path = repo.get_path();
|
||||
println!("path: {}", path.unwrap().get_path().unwrap().to_str().unwrap());
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user