Skip to main content

EitherArmProbe

Struct EitherArmProbe 

Source
#[doc(hidden)]
pub struct EitherArmProbe<R>(PhantomData<fn() -> R>);
Expand description

Reads TryFromSexp::CHARACTER_ONLY of the R arm of an Either<T, R> choice parameter without requiring R: TryFromSexp.

#[miniextendr] emits, for each such arm (inside the generated C wrapper),

ⓘ
{
    use ::miniextendr_api::match_arg::EitherArmProbeFallback as _;
    const _: () = ::core::assert!(
        !::miniextendr_api::match_arg::EitherArmProbe::<R>::CHARACTER_ONLY,
        "...",
    );
}

The path resolves to the inherent const below when R: TryFromSexp holds. When it does not, path resolution rejects the inherent candidate (its impl bound fails) and falls back to the const of EitherArmProbeFallback, which is false. So the check adds no error of its own for an R without a conversion: the decode’s single “R: TryFromSexp is not satisfied” is the whole diagnostic. Naming <R as TryFromSexp>::CHARACTER_ONLY directly would report that missing impl a second time.

Tuple Fields§

§0: PhantomData<fn() -> R>

Implementations§

Source§

impl<R: TryFromSexp> EitherArmProbe<R>

Source

pub const CHARACTER_ONLY: bool = R::CHARACTER_ONLY

Source

pub const CHOICE_NATIVE_BORROW: Option<NativeBorrow>

The native borrow of the choice parameter: none for character or factor input, which is the owned choice, else what R borrows (NativeBorrow::choice_or). The generated alias check reads it (#1504).

Trait Implementations§

Source§

impl<R> EitherArmProbeFallback for EitherArmProbe<R>

Source§

const CHARACTER_ONLY: bool = false

Always false.
Source§

const CHOICE_NATIVE_BORROW: Option<NativeBorrow> = None

Always None: no conversion, nothing to check.

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