pub struct FieldFallback {
pub get: LitStr,
pub names: Option<LitStr>,
}Expand description
The fallback of the field readers of s3(r_data_accessors),
s4(r_data_accessors) and env(r_data_accessors) (#2150):
fallback = "Self::column", and optionally
fallback_names = "Self::column_names", in the path style of
#[r_data(get = "Self::f")].
fallback names a fn(&Self, name: &str) -> Option<T>, T: IntoR,
which the readers call on the live Rust value for a name no field has, on
the bare pointer (an S3 or env object’s classed pointer, an S4 object’s
ptr); a list or environment carrying the pointer in .ptr keeps its own
elements for those names. Fields win, a [[ position counts the fields
only, names() / as.list() stay the fields, and an assignment to a name
no field has is refused as before. None reads what an unknown name
reads without the fallback: miniextendr_no_field on S3 (default lookup)
and S4, NULL under lookup = "list" and on an env class (whose $
tries the methods before the fallback). The macro handles the Option
itself, so Some(x) reads x and a scalar T is never NA for None.
fallback_names names a fn(&Self) -> Vec<String>: .DollarNames()
offers its names after the fields (after the methods on an env class).
Without it, completion offers the fields only.
The impl expansion emits one .Call entry for each
(field_syntax::fallback_c_entries), so only one impl block of a type
carries the option: it is not a class setting the blocks repeat
(ParsedImpl::class_settings) but part of the class that block defines
(ParsedImpl::class_definitions), next to the constructor.
Fields§
§get: LitStrfallback = "Self::column": the path, as written.
names: Option<LitStr>fallback_names = "Self::column_names", as written.
Trait Implementations§
Source§impl Clone for FieldFallback
impl Clone for FieldFallback
Auto Trait Implementations§
impl !Send for FieldFallback
impl !Sync for FieldFallback
impl Freeze for FieldFallback
impl RefUnwindSafe for FieldFallback
impl Unpin for FieldFallback
impl UnsafeUnpin for FieldFallback
impl UnwindSafe for FieldFallback
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> SizeHint for Twhere
T: ?Sized,
impl<T> SizeHint for Twhere
T: ?Sized,
Source§default fn lower_bound(&self) -> usize
default fn lower_bound(&self) -> usize
core_io_internals)[u8; 12] could return any value between 0 and
12 inclusively as a correct implementation. Read moreSource§impl<T> SizedTypeProperties for T
impl<T> SizedTypeProperties for T
Source§#[doc(hidden)]const SIZE: usize = _
#[doc(hidden)]const SIZE: usize = _
sized_type_properties)Source§#[doc(hidden)]const ALIGN: usize = _
#[doc(hidden)]const ALIGN: usize = _
sized_type_properties)Source§#[doc(hidden)]const ALIGNMENT: Alignment = _
#[doc(hidden)]const ALIGNMENT: Alignment = _
ptr_alignment_type)Source§#[doc(hidden)]const IS_ZST: bool = _
#[doc(hidden)]const IS_ZST: bool = _
sized_type_properties)Source§#[doc(hidden)]const LAYOUT: Layout = _
#[doc(hidden)]const LAYOUT: Layout = _
sized_type_properties)Source§#[doc(hidden)]const MAX_SLICE_LEN: usize = _
#[doc(hidden)]const MAX_SLICE_LEN: usize = _
sized_type_properties)[Self]. Read moreLayout§
Note: Most layout information is completely unstable and may even differ between compilations. The only exception is types with certain repr(...) attributes. Please see the Rust Reference's “Type Layout” chapter for details on type layout guarantees.
Size: 16 bytes