Skip to main content

reifydb_value/value/
diff_type.rs

1// SPDX-License-Identifier: Apache-2.0
2// Copyright (c) 2026 ReifyDB
3
4use serde::{Deserialize, Serialize};
5
6#[repr(C)]
7#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
8pub enum DiffType {
9	Insert = 1,
10
11	Update = 2,
12
13	Remove = 3,
14}
15
16impl DiffType {
17	#[inline]
18	pub const fn as_u8(self) -> u8 {
19		self as u8
20	}
21
22	#[inline]
23	pub const fn from_u8(raw: u8) -> Option<Self> {
24		match raw {
25			1 => Some(DiffType::Insert),
26			2 => Some(DiffType::Update),
27			3 => Some(DiffType::Remove),
28			_ => None,
29		}
30	}
31}