Skip to content

Commit 5d10d81

Browse files
authored
Add Context::from_arc_dwarf (#327)
The context was already using `Arc` internally, so this allows the caller to use the same `Dwarf` for other purposes.
1 parent 48f4734 commit 5d10d81

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

src/lib.rs

+6-1
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,12 @@ impl<R: gimli::Reader> Context<R> {
139139
/// Construct a new `Context` from an existing [`gimli::Dwarf`] object.
140140
#[inline]
141141
pub fn from_dwarf(sections: gimli::Dwarf<R>) -> Result<Context<R>, Error> {
142-
let sections = Arc::new(sections);
142+
Self::from_arc_dwarf(Arc::new(sections))
143+
}
144+
145+
/// Construct a new `Context` from an existing [`gimli::Dwarf`] object.
146+
#[inline]
147+
pub fn from_arc_dwarf(sections: Arc<gimli::Dwarf<R>>) -> Result<Context<R>, Error> {
143148
let units = ResUnits::parse(&sections)?;
144149
let sup_units = if let Some(sup) = sections.sup.as_ref() {
145150
SupUnits::parse(sup)?

0 commit comments

Comments
 (0)