Skip to main content

reifydb_core/
execution.rs

1// SPDX-License-Identifier: Apache-2.0
2// Copyright (c) 2025 ReifyDB
3
4use std::ops::Deref;
5
6use reifydb_type::{error::Error, value::frame::frame::Frame};
7
8use crate::metric::ExecutionMetrics;
9
10#[derive(Debug)]
11pub struct ExecutionResult {
12	pub frames: Vec<Frame>,
13	pub error: Option<Error>,
14	pub metrics: ExecutionMetrics,
15}
16
17impl ExecutionResult {
18	pub fn is_ok(&self) -> bool {
19		self.error.is_none()
20	}
21
22	pub fn is_err(&self) -> bool {
23		self.error.is_some()
24	}
25
26	pub fn check(self) -> Result<Self, Error> {
27		match self.error {
28			Some(e) => Err(e),
29			None => Ok(self),
30		}
31	}
32}
33
34impl Deref for ExecutionResult {
35	type Target = [Frame];
36
37	fn deref(&self) -> &[Frame] {
38		&self.frames
39	}
40}