Renamed Value to JsonValue to make things a little more clear

This commit is contained in:
Dave Hrycyszyn
2024-05-30 15:45:38 +01:00
parent 0733e12539
commit 3120ceee5d
7 changed files with 108 additions and 102 deletions

View File

@@ -1,5 +1,5 @@
use crate::debug::DebugView;
use crate::json_crdt::{CrdtNode, OpState, Value};
use crate::json_crdt::{CrdtNode, OpState, JsonValue};
use crate::op::{join_path, print_path, Op, PathSegment, SequenceNumber};
use std::cmp::{max, Ordering};
use std::fmt::Debug;
@@ -38,7 +38,7 @@ where
}
/// Sets the current value of the register
pub fn set<U: Into<Value>>(&mut self, content: U) -> Op<Value> {
pub fn set<U: Into<JsonValue>>(&mut self, content: U) -> Op<JsonValue> {
let mut op = Op::new(
self.value.id,
self.our_id,
@@ -57,7 +57,7 @@ where
}
/// Apply an operation (both local and remote) to this local register CRDT.
pub fn apply(&mut self, op: Op<Value>) -> OpState {
pub fn apply(&mut self, op: Op<JsonValue>) -> OpState {
if !op.is_valid_hash() {
return OpState::ErrHashMismatch;
}
@@ -100,11 +100,11 @@ impl<T> CrdtNode for LwwRegisterCrdt<T>
where
T: CrdtNode,
{
fn apply(&mut self, op: Op<Value>) -> OpState {
fn apply(&mut self, op: Op<JsonValue>) -> OpState {
self.apply(op.into())
}
fn view(&self) -> Value {
fn view(&self) -> JsonValue {
self.view().into()
}