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 committed Aug 6, 2024
1 parent 3496387 commit c274d33
Showing 1 changed file with 2 additions and 2 deletions.
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 c274d33

Please sign in to comment.