Skip to main content

PlexusRequestField

Trait PlexusRequestField 

Source
pub trait PlexusRequestField: Sized {
    // Required method
    fn extract_from_raw(ctx: &RawRequestContext) -> Result<Self, PlexusError>;
}
Expand description

Trait for newtype field types that carry their own extraction and validation logic.

Implement this trait on a newtype wrapper to enable #[derive(PlexusRequest)] to extract it without an explicit source annotation. The macro generates:

let field_name = FieldType::extract_from_raw(ctx)?;

for fields of any type that implements PlexusRequestField.

Required Methods§

Source

fn extract_from_raw(ctx: &RawRequestContext) -> Result<Self, PlexusError>

Extract and validate Self from the raw HTTP request context.

Return Ok(Self) on success, or a PlexusError (typically PlexusError::Unauthenticated) on validation failure.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§