The `ExId` structure has some internal details which make lookups for object IDs which were produced by the document doing the looking up faster. These internal details are quite specific to the implementation so we don't want to expose them as a public API. On the other hand, we need to be able to serialize `ExId`s so that FFI clients can hold on to them without referencing memory which is owned by the document (ahem, looking at you Java). Introduce `ExId::to_bytes` and `TryFrom<&[u8]> ExId` implementing a canonical serialization which includes a version tag, giveing us compatibility options if we decide to change the implementation.
113 lines
2.6 KiB
Rust
113 lines
2.6 KiB
Rust
#![doc(
|
|
html_logo_url = "https://raw.githubusercontent.com/automerge/automerge-rs/main/img/brandmark.svg",
|
|
html_favicon_url = "https:///raw.githubusercontent.com/automerge/automerge-rs/main/img/favicon.ico"
|
|
)]
|
|
#![warn(
|
|
missing_debug_implementations,
|
|
// missing_docs, // TODO: add documentation!
|
|
rust_2018_idioms,
|
|
unreachable_pub,
|
|
bad_style,
|
|
dead_code,
|
|
improper_ctypes,
|
|
non_shorthand_field_patterns,
|
|
no_mangle_generic_items,
|
|
overflowing_literals,
|
|
path_statements,
|
|
patterns_in_fns_without_body,
|
|
private_in_public,
|
|
unconditional_recursion,
|
|
unused,
|
|
unused_allocation,
|
|
unused_comparisons,
|
|
unused_parens,
|
|
while_true
|
|
)]
|
|
|
|
#[doc(hidden)]
|
|
#[macro_export]
|
|
macro_rules! log {
|
|
( $( $t:tt )* ) => {
|
|
{
|
|
use $crate::__log;
|
|
__log!( $( $t )* );
|
|
}
|
|
}
|
|
}
|
|
|
|
#[cfg(all(feature = "wasm", target_family = "wasm"))]
|
|
#[doc(hidden)]
|
|
#[macro_export]
|
|
macro_rules! __log {
|
|
( $( $t:tt )* ) => {
|
|
web_sys::console::log_1(&format!( $( $t )* ).into());
|
|
}
|
|
}
|
|
|
|
#[cfg(not(all(feature = "wasm", target_family = "wasm")))]
|
|
#[doc(hidden)]
|
|
#[macro_export]
|
|
macro_rules! __log {
|
|
( $( $t:tt )* ) => {
|
|
println!( $( $t )* );
|
|
}
|
|
}
|
|
|
|
mod autocommit;
|
|
mod automerge;
|
|
mod autoserde;
|
|
mod change;
|
|
mod clock;
|
|
mod clocks;
|
|
mod columnar;
|
|
mod convert;
|
|
mod error;
|
|
mod exid;
|
|
mod indexed_cache;
|
|
mod keys;
|
|
mod keys_at;
|
|
mod legacy;
|
|
mod list_range;
|
|
mod list_range_at;
|
|
mod map_range;
|
|
mod map_range_at;
|
|
mod op_observer;
|
|
mod op_set;
|
|
mod op_tree;
|
|
mod parents;
|
|
mod query;
|
|
mod sequence_tree;
|
|
mod storage;
|
|
pub mod sync;
|
|
pub mod transaction;
|
|
mod types;
|
|
mod value;
|
|
mod values;
|
|
#[cfg(feature = "optree-visualisation")]
|
|
mod visualisation;
|
|
|
|
pub use crate::automerge::Automerge;
|
|
pub use autocommit::{AutoCommit, AutoCommitWithObs};
|
|
pub use autoserde::AutoSerde;
|
|
pub use change::{Change, LoadError as LoadChangeError};
|
|
pub use error::AutomergeError;
|
|
pub use error::InvalidActorId;
|
|
pub use error::InvalidChangeHashSlice;
|
|
pub use exid::{ExId as ObjId, ObjIdFromBytesError};
|
|
pub use keys::Keys;
|
|
pub use keys_at::KeysAt;
|
|
pub use legacy::Change as ExpandedChange;
|
|
pub use list_range::ListRange;
|
|
pub use list_range_at::ListRangeAt;
|
|
pub use map_range::MapRange;
|
|
pub use map_range_at::MapRangeAt;
|
|
pub use op_observer::OpObserver;
|
|
pub use op_observer::Patch;
|
|
pub use op_observer::VecOpObserver;
|
|
pub use parents::{Parent, Parents};
|
|
pub use sequence_tree::SequenceTree;
|
|
pub use types::{ActorId, ChangeHash, ObjType, OpType, ParseChangeHashError, Prop, TextEncoding};
|
|
pub use value::{ScalarValue, Value};
|
|
pub use values::Values;
|
|
|
|
pub const ROOT: ObjId = ObjId::Root;
|