Skip to main content

StandardDirective

Trait StandardDirective 

Source
pub trait StandardDirective {
    type Value;
    type Type;

    // Required method
    fn as_standard(&self) -> Option<&ProgramDirective<Self::Value, Self::Type>>;
}
Expand description

A header declaration that may be a standard directive.

Implemented by ProgramDirective itself. An application declaration enum implements it by returning its standard variant, so that checkers, formatters, and loaders can find the standard directives among the application’s own:

use vihaco_module::module::{ProgramDirective, StandardDirective};

enum Declaration {
    Standard(ProgramDirective),
    Description(String),
}

impl StandardDirective for Declaration {
    type Value = vihaco_abi::Value;
    type Type = vihaco_abi::Type;

    fn as_standard(&self) -> Option<&ProgramDirective> {
        match self {
            Self::Standard(directive) => Some(directive),
            Self::Description(_) => None,
        }
    }
}

Required Associated Types§

Required Methods§

Source

fn as_standard(&self) -> Option<&ProgramDirective<Self::Value, Self::Type>>

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§