global_paths/
global-paths.rs1use std::borrow::Cow;
2use std::path::Path;
3
4use interner::global::{GlobalPath, PathPool, StaticPooledPath};
5
6static PATH_POOL: PathPool = PathPool::new();
7static STATIC_PATH: StaticPooledPath = PATH_POOL.get_static_with(|| Cow::Borrowed(Path::new("a")));
10
11fn main() {
12 STATIC_PATH.get();
15 let a_again = PATH_POOL.get(Path::new("a"));
17
18 assert!(GlobalPath::ptr_eq(&*STATIC_PATH, &a_again));
20
21 drop(a_again);
24 let pooled: Vec<GlobalPath> = PATH_POOL.pooled();
25 assert_eq!(pooled.len(), 1);
26 assert_eq!(pooled[0], Path::new("a"));
27}
28
29#[test]
30fn runs() {
31 main();
32}