LateInstanceDyn

Struct LateInstanceDyn 

Source
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>

Source

pub fn non_dynamic(&mut self) -> &mut LateInstance<S>

Obtains a reference to the underlying LateInstance.

Source

pub fn init_token(&self) -> LateLayoutInitToken

Source

pub fn fields(&self) -> &'static [&'static LateFieldDescriptor<S>]

Forwards to LateInstance::fields.

Source

pub fn get_ptr<F: LateField<S>>(&self) -> NonNull<F::Value>

Forwards to LateInstance::get_ptr.

Source

pub fn get_erased_ptr( &self, field: &LateFieldDescriptor<S>, ) -> NonNull<S::EraseTo>

Source

pub fn get_mut<F: LateField<S>>(&mut self) -> &mut F::Value

Forwards to LateInstance::get_mut.

Source

pub fn borrow<F: LateField<S>>(&self) -> Ref<'_, F::Value>

Borrow the field identified by the supplied LateField marker type immutably, panicking if the borrow failed.

The smart-pointers returned by this method are compatible with those returned by RefCell.

Source

pub fn borrow_mut<F: LateField<S>>(&self) -> RefMut<'_, F::Value>

Borrow the field identified by the supplied LateField marker type mutably, panicking if the borrow failed.

The smart-pointers returned by this method are compatible with those returned by RefCell.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Trait Implementations§

Source§

impl<S: LateStruct> Debug for LateInstanceDyn<S>
where S::EraseTo: Debug,

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl<S> Freeze for LateInstanceDyn<S>

§

impl<S> !RefUnwindSafe for LateInstanceDyn<S>

§

impl<S> !Send for LateInstanceDyn<S>

§

impl<S> !Sync for LateInstanceDyn<S>

§

impl<S> Unpin for LateInstanceDyn<S>

§

impl<S> UnwindSafe for LateInstanceDyn<S>

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>,

Source§

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>,

Source§

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.