forked from gtk-rs/gir
-
Notifications
You must be signed in to change notification settings - Fork 0
/
env.rs
46 lines (42 loc) · 1.17 KB
/
env.rs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
use std::cell::RefCell;
use analysis;
use config::Config;
use config::gobjects::GStatus;
use library::*;
use version::Version;
pub struct Env {
pub library: Library,
pub config: Config,
pub namespaces: analysis::namespaces::Info,
pub symbols: RefCell<analysis::symbols::Info>,
pub class_hierarchy: analysis::class_hierarchy::Info,
pub analysis: analysis::Analysis,
}
impl Env {
#[inline]
pub fn type_(&self, tid: TypeId) -> &Type {
self.library.type_(tid)
}
pub fn type_status(&self, name: &str) -> GStatus {
self.config
.objects
.get(name)
.map(|o| o.status)
.unwrap_or_default()
}
pub fn type_status_sys(&self, name: &str) -> GStatus {
self.config
.objects
.get(name)
.map(|o| o.status)
.unwrap_or(GStatus::Generate)
}
pub fn is_totally_deprecated(&self, deprecated_version: Option<Version>) -> bool {
match deprecated_version {
Some(version) if version <= self.config.min_cfg_version => {
self.config.deprecate_by_min_version
}
_ => false,
}
}
}