pub(crate) struct Formals {
declared: HashMap<String, LitStr>,
}Expand description
The R formal of each parameter of one signature (#1842).
A parameter declared with formal = "conf.int" (a standalone function’s
per-parameter option, a method’s formal(conf_int = "conf.int")) has that
formal; every other one has normalize_r_arg_string of its Rust name.
Formals::of is the one place that rule lives: every site that writes a
parameter’s name into R text (the formals, the .Call() arguments, the
argument checks and their errors, e$param of a conversion error, the
@param lines) asks it. Maps keyed by Rust name (the per-parameter
options) stay keyed by Rust name, and so do the match_arg placeholders,
which the wrapper writer replaces before R reads them.
A declared formal may hold a ., which no Rust identifier can, so it is
only ever a string: never an identifier, and never part of one.
Fields§
§declared: HashMap<String, LitStr>The declared formals, keyed by Rust parameter name
(crate::naming::ident_name), each with the literal that declared
it (where its errors point).
Implementations§
Source§impl Formals
impl Formals
Sourcepub(crate) fn from_param_attrs(per_param: &HashMap<String, ParamAttrs>) -> Self
pub(crate) fn from_param_attrs(per_param: &HashMap<String, ParamAttrs>) -> Self
The formals the per-parameter options of one signature declare.
Sourcepub(crate) fn of(&self, rust_name: &str) -> String
pub(crate) fn of(&self, rust_name: &str) -> String
The R formal of the parameter whose Rust name is rust_name: its
declared formal, else the name without leading underscores.
Sourcepub(crate) fn of_ident(&self, ident: &Ident) -> String
pub(crate) fn of_ident(&self, ident: &Ident) -> String
Self::of the parameter ident (r# dropped).
Sourcepub(crate) fn declared(&self, rust_name: &str) -> Option<&LitStr>
pub(crate) fn declared(&self, rust_name: &str) -> Option<&LitStr>
The literal that declared the formal of rust_name, if one did.
Sourcepub(crate) fn rekey<V>(
&self,
map: impl IntoIterator<Item = (String, V)>,
) -> HashMap<String, V>
pub(crate) fn rekey<V>( &self, map: impl IntoIterator<Item = (String, V)>, ) -> HashMap<String, V>
map with each key, a Rust parameter name, replaced by that
parameter’s R formal: for maps keyed by Rust name (a function’s
default = "..", a method’s defaults(p = "..")) that feed a builder
keyed by R formal.
Trait Implementations§
Auto Trait Implementations§
impl !Send for Formals
impl !Sync for Formals
impl Freeze for Formals
impl RefUnwindSafe for Formals
impl Unpin for Formals
impl UnsafeUnpin for Formals
impl UnwindSafe for Formals
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: 48 bytes