pub(crate) struct PerParamMiniextendrAttr {
pub has_coerce: bool,
pub has_convert: bool,
pub has_match_arg: bool,
pub default_value: Option<(String, Span)>,
pub choices: Option<Vec<String>>,
pub has_several_ok: bool,
pub has_no_default: bool,
pub checks: ExplicitChecks,
pub preconditions: Option<bool>,
pub formal: Option<LitStr>,
}Expand description
Parsed per-parameter #[miniextendr(...)] attribute content.
A single attribute can contain multiple items, e.g.
#[miniextendr(match_arg, default = "Safe")]; a parameter carrying
several attributes gets them merged (PerParamMiniextendrAttr::merge).
Fields§
§has_coerce: boolWhether coerce was present, enabling automatic type coercion for this parameter
(e.g., i32 to u16, f64 to f32).
has_convert: boolUse the reference type’s conversion instead of borrowing an ExternalPtr.
has_match_arg: boolWhether match_arg was present, generating R match.arg() validation for
string parameters against a set of allowed values.
default_value: Option<(String, Span)>Default value from default = "...", if present. The tuple contains the default
value string and the attribute span (for error reporting).
choices: Option<Vec<String>>Choices for string parameters: #[miniextendr(choices("a", "b", "c"))].
has_several_ok: boolWhether several_ok was present, enabling multi-value match.arg(several.ok = TRUE).
Only valid with choices(...) or match_arg.
has_no_default: boolWhether no_default was present: the choice parameter’s R formal has
no default (#1828). Only valid with choices(...) or match_arg, and
not together with default.
checks: ExplicitChecksinherits = "cls" / inherits("a", "b"), not_inherits (the same
spellings) and no_na, each with an optional message = "...": R-side
checks named by the author (see
crate::r_preconditions::ExplicitChecks).
preconditions: Option<bool>preconditions / no_preconditions on the parameter (#1566):
Some(true) keeps its type-derived R-side checks, Some(false) drops
them. The last one written wins.
formal: Option<LitStr>formal = "conf.int": the parameter’s R formal (#1842), checked by
crate::r_wrapper_builder::check_r_formals.
Implementations§
Source§impl PerParamMiniextendrAttr
impl PerParamMiniextendrAttr
Sourcepub(crate) fn merge(
&mut self,
other: PerParamMiniextendrAttr,
) -> Result<(), String>
pub(crate) fn merge( &mut self, other: PerParamMiniextendrAttr, ) -> Result<(), String>
Merge the options of another attribute on the same parameter: flags
add up, the first default / choices(...) wins, the last
preconditions / no_preconditions wins, and the checks merge (one
message per check; the error says which). A second formal is an
error.
Trait Implementations§
Auto Trait Implementations§
impl !Send for PerParamMiniextendrAttr
impl !Sync for PerParamMiniextendrAttr
impl Forget for PerParamMiniextendrAttr
impl Freeze for PerParamMiniextendrAttr
impl RefUnwindSafe for PerParamMiniextendrAttr
impl Unpin for PerParamMiniextendrAttr
impl UnsafeUnpin for PerParamMiniextendrAttr
impl UnwindSafe for PerParamMiniextendrAttr
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> 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: 232 bytes