pub struct LoadOptions<'a> { /* private fields */ }
Implementations§
source§impl<'a> LoadOptions<'a>
impl<'a> LoadOptions<'a>
pub fn new() -> LoadOptions<'static>
sourcepub fn on_partial_load(self, on_partial_load: OnPartialLoad) -> Self
pub fn on_partial_load(self, on_partial_load: OnPartialLoad) -> Self
What to do when loading a document partially succeeds
The default is OnPartialLoad::Error
sourcepub fn verification_mode(self, verification_mode: VerificationMode) -> Self
pub fn verification_mode(self, verification_mode: VerificationMode) -> Self
Whether to verify the head hashes after loading
The default is VerificationMode::Check
sourcepub fn patch_log(self, patch_log: &'a mut PatchLog) -> Self
pub fn patch_log(self, patch_log: &'a mut PatchLog) -> Self
A PatchLog
to log the changes required to materialize the current state of the
The default is to not log patches
sourcepub fn migrate_strings(self, migration: StringMigration) -> Self
pub fn migrate_strings(self, migration: StringMigration) -> Self
Whether to convert ScalarValue::Str
s in the loaded document to ObjType::Text
Until version 2.1.0 of the javascript library strings (as in, the native string of the JS
runtime) were represented in the document as ScalarValue::Str
and there was a special
JS class called Text
which users were expected to use for ObjType::Text
. In 2.1.0
we changed this so that native strings were represented as ObjType::Text
and
ScalarValue::Str
was represented as a special RawString
class. This means
that upgrading the application code to use the new API would require either
a) Maintaining two code paths in the application to deal with both string
and RawString
types
b) Writing a migration script to convert all RawString
types to string
The latter is logic which is the same for all applications so we implement it in the
library for convenience. The way this works is that after loading the document we iterate
through all visible ScalarValue::Str
values and emit a change which creates a new
ObjType::Text
at the same path with the same content.