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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
//! Concrete aliases for the value model, with no per-value metadata.
//!
//! Every type in the value model is generic over a metadata payload `M`, defaulted to
//! [`NoMeta`]. Rust applies that default in type position but never in expression
//! position, so spelling the generic names in a `let` demands an annotation or a
//! turbofish. A path through these aliases pins `M = NoMeta` before inference starts,
//! which makes the parameter disappear entirely:
//!
//! ```
//! use ltk_meta::concrete::{values, Bin, BinObject};
//!
//! // Uninferrable through the generic names; fine through the aliases.
//! let list = values::Container::from(vec![values::I32::new(1), values::I32::new(2)]);
//!
//! let bin = Bin::builder()
//! .object(
//! BinObject::builder(0x1111u32, 0x2222u32)
//! .property(0x3333u32, values::F32::new(1.5))
//! .property(0x4444u32, list)
//! .build(),
//! )
//! .build();
//! # assert_eq!(bin.objects.len(), 1);
//! ```
//!
//! The streaming surface splits along the same line. Its views and cursors are only ever named
//! in type position, where the default already applies, so they come from the crate root. What
//! needs an alias is what a caller writes in *expression* position: [`BinStream::mount`] and
//! [`LruObjectCache::new`]. [`NoCache`] is not generic and so pins nothing; it is re-exported
//! rather than aliased, because an associated function like `new` resolves through a type alias
//! but a unit struct's value constructor does not - so that a cache policy and its LRU sibling
//! are still named from one import.
//!
//! ```no_run
//! use std::{fs::File, num::NonZeroUsize};
//! use ltk_meta::concrete::{BinStream, LruObjectCache};
//!
//! let mut stream = BinStream::mount(File::open("data.bin")?)?;
//! stream.set_cache(Box::new(LruObjectCache::new(NonZeroUsize::try_from(64)?)));
//! # Ok::<(), Box<dyn std::error::Error>>(())
//! ```
//!
//! Code that carries metadata (such as `ltk_ritobin`, which threads source spans)
//! keeps using the generic types directly.
//!
//! [`NoMeta`]: crate::property::NoMeta
//! [`BinStream::mount`]: crate::stream::BinStream::mount
//! [`LruObjectCache::new`]: crate::stream::LruObjectCache::new
pub type Bin = crateBin;
pub type BinObject = crateBinObject;
pub type BinStream<R> = crateBinStream;
pub type LruObjectCache = crateLruObjectCache;
pub use crateNoCache;
pub type BinFile = crateBinFile;
pub type BinOverride = crateBinOverride;
pub type PropertyPatch = cratePropertyPatch;
pub type PropertyValueEnum = cratePropertyValueEnum;
pub type ValueSlot<'a> = crateValueSlot;
/// Non-generic aliases for [`crate::property::values`].