Skip to content

Commit

Permalink
Allow the user to modify the BV during initialization
Browse files Browse the repository at this point in the history
  • Loading branch information
rbran authored and emesare committed Aug 24, 2024
1 parent 264b8aa commit 1c3aa23
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions rust/examples/minidump/src/view.rs
Original file line number Diff line number Diff line change
Expand Up @@ -392,7 +392,7 @@ unsafe impl CustomBinaryView for MinidumpBinaryView {
Ok(MinidumpBinaryView::new(handle))
}

fn init(&self, _args: Self::Args) -> BinaryViewResult<()> {
self.init()
fn init(&mut self, _args: Self::Args) -> BinaryViewResult<()> {
MinidumpBinaryView::init(self)
}
}
4 changes: 2 additions & 2 deletions rust/src/custombinaryview.rs
Original file line number Diff line number Diff line change
Expand Up @@ -329,7 +329,7 @@ pub unsafe trait CustomBinaryView: 'static + BinaryViewBase + Sync + Sized {
type Args: Send;

fn new(handle: &BinaryView, args: &Self::Args) -> Result<Self>;
fn init(&self, args: Self::Args) -> Result<()>;
fn init(&mut self, args: Self::Args) -> Result<()>;
}

/// Represents a partially initialized custom `BinaryView` that should be returned to the core
Expand Down Expand Up @@ -432,7 +432,7 @@ impl<'a, T: CustomBinaryViewType> CustomViewBuilder<'a, T> {

match context
.view
.assume_init_ref()
.assume_init_mut()
.init(ptr::read(&context.args))
{
Ok(_) => true,
Expand Down

0 comments on commit 1c3aa23

Please sign in to comment.