Skip to main content

EvaluateContext

Trait EvaluateContext 

Source
pub trait EvaluateContext {
    type InfoMessage: DeserializeOwned;
    type RequestMessage: DeserializeOwned;
    type ResponseMessage: Serialize;
    type State: Default;

    // Required methods
    fn pool(&self) -> OperationVc<EvaluatePool>;
    fn args(&self) -> &[ResolvedVc<JsonValue>];
    fn cwd(&self) -> Vc<FileSystemPath>;
    fn emit_error(
        &self,
        error: StructuredError,
        pool: &EvaluatePool,
    ) -> impl Future<Output = Result<()>> + Send;
    fn info(
        &self,
        state: &mut Self::State,
        data: Self::InfoMessage,
        pool: &EvaluatePool,
    ) -> impl Future<Output = Result<()>> + Send;
    fn request(
        &self,
        state: &mut Self::State,
        data: Self::RequestMessage,
        pool: &EvaluatePool,
    ) -> impl Future<Output = Result<Self::ResponseMessage>> + Send;
    fn finish(
        &self,
        state: Self::State,
        pool: &EvaluatePool,
    ) -> impl Future<Output = Result<()>> + Send;

    // Provided methods
    fn keep_alive(&self) -> bool { ... }
    fn crash_context_prefix(&self) -> Option<RcStr> { ... }
}

Required Associated Types§

Required Methods§

Source

fn pool(&self) -> OperationVc<EvaluatePool>

Source

fn args(&self) -> &[ResolvedVc<JsonValue>]

Source

fn cwd(&self) -> Vc<FileSystemPath>

Source

fn emit_error( &self, error: StructuredError, pool: &EvaluatePool, ) -> impl Future<Output = Result<()>> + Send

Source

fn info( &self, state: &mut Self::State, data: Self::InfoMessage, pool: &EvaluatePool, ) -> impl Future<Output = Result<()>> + Send

Source

fn request( &self, state: &mut Self::State, data: Self::RequestMessage, pool: &EvaluatePool, ) -> impl Future<Output = Result<Self::ResponseMessage>> + Send

Source

fn finish( &self, state: Self::State, pool: &EvaluatePool, ) -> impl Future<Output = Result<()>> + Send

Provided Methods§

Source

fn keep_alive(&self) -> bool

Source

fn crash_context_prefix(&self) -> Option<RcStr>

Optional human-readable prefix describing what was being evaluated, included verbatim in the message of the synthetic StructuredError emitted when the Node.js subprocess crashes mid-evaluation. For webpack-loader evaluations this is the loader chain (“loaders [foo, bar]”). The default returns None.

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§