pub struct FieldGetter<N = ()> { /* private fields */ }Expand description
Resolves a reflected field once, then uses its registered C ABI getter.
FieldGetter::new resolves a field by runtime type index into a
FieldGetter, which checks the type of each object it reads. FieldGetter::of resolves a field of the
object type N into a FieldGetter<N>, which reads only &N, so the
type system replaces that check; cached_field_getter!
keeps one for the process.
Implementations§
Source§impl FieldGetter
impl FieldGetter
Sourcepub fn new(type_index: i32, field_name: &str) -> Result<Self>
pub fn new(type_index: i32, field_name: &str) -> Result<Self>
Resolve a reflected field declared by type_index or one of its bases.
§Errors
Returns a TypeError if type_index is not registered or the type has
no reflected field field_name with a getter.
Sourcepub fn of<N: ObjectCore>(field_name: &str) -> Result<FieldGetter<N>>
pub fn of<N: ObjectCore>(field_name: &str) -> Result<FieldGetter<N>>
Resolve a reflected field declared by N or one of its bases.
§Errors
As FieldGetter::new for N::type_index().
Trait Implementations§
Source§impl<N> Clone for FieldGetter<N>
impl<N> Clone for FieldGetter<N>
impl<N> Copy for FieldGetter<N>
Auto Trait Implementations§
impl<N> Freeze for FieldGetter<N>
impl<N> RefUnwindSafe for FieldGetter<N>
impl<N> Send for FieldGetter<N>
impl<N> Sync for FieldGetter<N>
impl<N> Unpin for FieldGetter<N>
impl<N> UnsafeUnpin for FieldGetter<N>
impl<N> UnwindSafe for FieldGetter<N>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more