pub struct LateInstanceDyn<S: LateStruct> { /* private fields */ }Expand description
A view around a LateInstance which exposes a RefCell-like API for dynamically borrowing
multiple fields mutably at the same time.
Implementations§
Source§impl<S: LateStruct> LateInstanceDyn<S>
impl<S: LateStruct> LateInstanceDyn<S>
Sourcepub fn non_dynamic(&mut self) -> &mut LateInstance<S>
pub fn non_dynamic(&mut self) -> &mut LateInstance<S>
Obtains a reference to the underlying LateInstance.
Sourcepub fn init_token(&self) -> LateLayoutInitToken
pub fn init_token(&self) -> LateLayoutInitToken
Forwards to LateInstance::init_token.
Sourcepub fn fields(&self) -> &'static [&'static LateFieldDescriptor<S>]
pub fn fields(&self) -> &'static [&'static LateFieldDescriptor<S>]
Forwards to LateInstance::fields.
Sourcepub fn get_erased_ptr(
&self,
field: &LateFieldDescriptor<S>,
) -> NonNull<S::EraseTo>
pub fn get_erased_ptr( &self, field: &LateFieldDescriptor<S>, ) -> NonNull<S::EraseTo>
Forwards to LateInstance::get_erased_ptr.
Sourcepub fn get_mut<F: LateField<S>>(&mut self) -> &mut F::Value
pub fn get_mut<F: LateField<S>>(&mut self) -> &mut F::Value
Forwards to LateInstance::get_mut.
Sourcepub fn borrow_mut<F: LateField<S>>(&self) -> RefMut<'_, F::Value>
pub fn borrow_mut<F: LateField<S>>(&self) -> RefMut<'_, F::Value>
Sourcepub fn try_borrow<F: LateField<S>>(
&self,
) -> Result<Ref<'_, F::Value>, BorrowError>
pub fn try_borrow<F: LateField<S>>( &self, ) -> Result<Ref<'_, F::Value>, BorrowError>
Borrow the field identified by the supplied LateField marker type immutably or return a
cell::BorrowError if the borrow failed.
The smart-pointers and errors returned by this method are compatible with those returned by
RefCell.
Sourcepub fn try_borrow_mut<F: LateField<S>>(
&self,
) -> Result<RefMut<'_, F::Value>, BorrowMutError>
pub fn try_borrow_mut<F: LateField<S>>( &self, ) -> Result<RefMut<'_, F::Value>, BorrowMutError>
Borrow the field identified by the supplied LateField marker type mutably or return a
cell::BorrowError if the borrow failed.
The smart-pointers and errors returned by this method are compatible with those returned by
RefCell.
Sourcepub fn borrow_erased<'a>(
&'a self,
field: &LateFieldDescriptor<S>,
) -> Ref<'a, S::EraseTo>
pub fn borrow_erased<'a>( &'a self, field: &LateFieldDescriptor<S>, ) -> Ref<'a, S::EraseTo>
Borrow the field identified by the supplied LateFieldDescriptor immutably, panicking
if the borrow failed.
The smart-pointers returned by this method are compatible with those returned by
RefCell.
Sourcepub fn borrow_erased_mut<'a>(
&'a self,
field: &LateFieldDescriptor<S>,
) -> RefMut<'a, S::EraseTo>
pub fn borrow_erased_mut<'a>( &'a self, field: &LateFieldDescriptor<S>, ) -> RefMut<'a, S::EraseTo>
Borrow the field identified by the supplied LateFieldDescriptor mutably, panicking
if the borrow failed.
The smart-pointers returned by this method are compatible with those returned by
RefCell.
Sourcepub fn try_borrow_erased<'a>(
&'a self,
field: &LateFieldDescriptor<S>,
) -> Result<Ref<'a, S::EraseTo>, BorrowError>
pub fn try_borrow_erased<'a>( &'a self, field: &LateFieldDescriptor<S>, ) -> Result<Ref<'a, S::EraseTo>, BorrowError>
Borrow the field identified by the supplied LateFieldDescriptor immutably or return a
cell::BorrowError if the borrow failed.
The smart-pointers and errors returned by this method are compatible with those returned by
RefCell.
Sourcepub fn try_borrow_erased_mut<'a>(
&'a self,
field: &LateFieldDescriptor<S>,
) -> Result<RefMut<'a, S::EraseTo>, BorrowMutError>
pub fn try_borrow_erased_mut<'a>( &'a self, field: &LateFieldDescriptor<S>, ) -> Result<RefMut<'a, S::EraseTo>, BorrowMutError>
Borrow the field identified by the supplied LateFieldDescriptor mutably or return a
cell::BorrowMutError if the borrow failed.
The smart-pointers and errors returned by this method are compatible with those returned by
RefCell.