pub struct CustomViewBuilder<'a, T: CustomBinaryViewType + ?Sized> { /* private fields */ }
Expand description

Represents a request from the core to instantiate a custom BinaryView

Implementations§

source§

impl<'a, T: CustomBinaryViewType> CustomViewBuilder<'a, T>

source

pub fn create<V>( self, parent: &BinaryView, view_args: V::Args ) -> Result<CustomView<'a>>

Begins creating a custom BinaryView.

This function may only be called from the create_custom_view function of a CustomBinaryViewType.

parent specifies the view that the core will treat as the parent view, that Segments created against the created view will be backed by parent. It will usually be (but is not required to be) the data argument of the create_custom_view callback.

constructor will not be called until well after the value returned by this function has been returned by create_custom_view callback to the core, and may not ever be called if the value returned by this function is dropped or leaked.

§Errors

This function will fail if the FileMetadata object associated with the expected parent (i.e., the data argument passed to the create_custom_view function) already has an associated BinaryView of the same CustomBinaryViewType. Multiple BinaryView objects of the same BinaryViewType belonging to the same FileMetadata object is prohibited and can cause strange, delayed segmentation faults.

§Safety

constructor should avoid doing anything with the object it returns, especially anything that would cause the core to invoke any of the BinaryViewBase methods. The core isn’t going to consider the object fully initialized until after that callback has run.

The BinaryView argument passed to the constructor function is the object that is expected to be returned by the AsRef<BinaryView> implementation required by the BinaryViewBase trait. TODO FIXME welp this is broke going to need 2 init callbacks

source

pub fn wrap_existing( self, wrapped_view: Ref<BinaryView> ) -> Result<CustomView<'a>>

Auto Trait Implementations§

§

impl<'a, T: ?Sized> RefUnwindSafe for CustomViewBuilder<'a, T>
where T: RefUnwindSafe,

§

impl<'a, T: ?Sized> Send for CustomViewBuilder<'a, T>

§

impl<'a, T: ?Sized> Sync for CustomViewBuilder<'a, T>

§

impl<'a, T: ?Sized> Unpin for CustomViewBuilder<'a, T>

§

impl<'a, T: ?Sized> UnwindSafe for CustomViewBuilder<'a, T>
where T: RefUnwindSafe,

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.