Skip to main content

ClassBlockEntry

Struct ClassBlockEntry 

Source
pub struct ClassBlockEntry {
Show 18 fields pub rust_type: &'static str, pub type_path: fn() -> &'static str, pub r_class_name: &'static str, pub source_file: &'static str, pub source_line: u32, pub source_column: u32, pub settings: &'static str, pub constructor: &'static str, pub constructor_inferred: bool, pub constructor_candidates: &'static [&'static str], pub demoted: Option<&'static ClassBlockEntry>, pub defines: &'static [&'static str], pub head: &'static str, pub class_docs: &'static str, pub class_doc_lines: &'static str, pub members: &'static str, pub member_names: &'static [&'static str], pub tail: &'static str,
}
Expand description

One #[miniextendr] impl block’s share of its Rust type’s R class (#1776).

A type’s methods may be split over several impl blocks. Each block registers its R wrapper in parts, and collect_r_wrappers writes one class per type: the defining block’s head, every block’s members in source order, then the defining block’s tail. The defining block is the one with a defines entry (at most one block may have any), else the first in source order. The class’s roxygen block has the class_docs of every block, the defining block’s first. Every part is R source, framed by the newline the macro’s raw string literal adds at each end.

Fields§

§rust_type: &'static str

Rust type identifier as written in the impl, e.g. "Counter".

§type_path: fn() -> &'static str

The type’s core::any::type_name, which tells apart two types that share an identifier. The blocks of one type are merged by it.

§r_class_name: &'static str

R-visible class name (class = "...", else the type’s identifier).

§source_file: &'static str

Source file of the impl block (file!()).

§source_line: u32

Line of the impl’s type in source_file.

§source_column: u32

Column of the impl’s type, for the # Generated from header.

§settings: &'static str

The class-level settings, rendered: class system and its options, class = "...", internal / noexport, and the @noRd / @keywords internal tags. They shape every block’s members, so all blocks of a type must have the same.

§constructor: &'static str

The Rust name of the block’s class constructor, "" when it has none: the method marked #[miniextendr(<system>(constructor))], else a receiver-less new returning Self, else (constructor_inferred) the block’s one candidate.

§constructor_inferred: bool

Whether constructor was inferred: the block declares none and has one candidate. The type’s constructor is then decided across its impl blocks when collect_r_wrappers merges them.

§constructor_candidates: &'static [&'static str]

The Rust names of the block’s receiver-less methods returning Self other than a declared constructor: the methods that could be the constructor of a type that declares none.

§demoted: Option<&'static ClassBlockEntry>

The block as it reads when another impl block of the type declares the constructor: present when the block infers one, which there stays a static method.

§defines: &'static [&'static str]

What this block has that only the defining block may: "a constructor" (or "the inferred constructor `name`"), "S7 properties", "the field fallback" (s3(r_data_accessors, fallback = ...), whose .Call entry the block emits and whose field methods call it).

§head: &'static str

The class definition as this block would write it: the class’s roxygen block (with the CLASS_DOCS_MARKER and CLASS_DOC_LINES_MARKER lines, and CLASS_DEFAULT_PREFIX lines), the class object, the constructor, and the class-level helpers.

§class_docs: &'static str

The block’s doc comment as roxygen lines (with the constructor’s for S3 and vctrs, whose class block is the constructor’s). The class’s roxygen block has every block’s, the defining block’s first; a tag repeated exactly is written once, and two blocks giving the class different @titles, or a page other than the defining block’s (@name, @rdname), are refused.

§class_doc_lines: &'static str

Roxygen lines this block’s members add to the class’s roxygen block, such as an R6 active binding’s @field or a lifecycle import.

§members: &'static str

The block’s members: its methods, static methods and coercions.

§member_names: &'static [&'static str]

Names the members bind in the class’s own namespaces ($name of an env class or of an R6 generator, R6 members, S4 and S7 method registrations), for the check that two blocks don’t bind the same one. Top-level functions are left to the duplicate-definition scan of the written file.

§tail: &'static str

What follows every block’s members, such as R6’s $lock().

Trait Implementations§

Auto Trait Implementations§

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> SizeHint for T
where T: ?Sized,

Source§

default fn lower_bound(&self) -> usize

🔬This is a nightly-only experimental API. (core_io_internals)
Returns a lower bound on the number of elements this container-like item contains. For example, an array [u8; 12] could return any value between 0 and 12 inclusively as a correct implementation. Read more
Source§

default fn upper_bound(&self) -> Option<usize>

🔬This is a nightly-only experimental API. (core_io_internals)
Returns an upper bound on the number of elements this container-like item contains if it can be determined, otherwise None. Read more
Source§

final fn size_hint(&self) -> (usize, Option<usize>)

🔬This is a nightly-only experimental API. (core_io_internals)
Returns an estimate for the number of elements this container like type contains. Read more
Source§

impl<T> SizedTypeProperties for T

Source§

#[doc(hidden)]
const SIZE: usize = _

🔬This is a nightly-only experimental API. (sized_type_properties)
Source§

#[doc(hidden)]
const ALIGN: usize = _

🔬This is a nightly-only experimental API. (sized_type_properties)
Source§

#[doc(hidden)]
const ALIGNMENT: Alignment = _

🔬This is a nightly-only experimental API. (ptr_alignment_type)
Source§

#[doc(hidden)]
const IS_ZST: bool = _

🔬This is a nightly-only experimental API. (sized_type_properties)
true if this type requires no storage. false if its size is greater than zero. Read more
Source§

#[doc(hidden)]
const LAYOUT: Layout = _

🔬This is a nightly-only experimental API. (sized_type_properties)
Source§

#[doc(hidden)]
const MAX_SLICE_LEN: usize = _

🔬This is a nightly-only experimental API. (sized_type_properties)
The largest safe length for a [Self]. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

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.

Layout§

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: 240 bytes