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::Strs 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.
pub fn text_encoding(self, text_encoding: TextEncoding) -> Self
Trait Implementations§
Source§impl<'a> Debug for LoadOptions<'a>
impl<'a> Debug for LoadOptions<'a>
Auto Trait Implementations§
impl<'a> Freeze for LoadOptions<'a>
impl<'a> RefUnwindSafe for LoadOptions<'a>
impl<'a> Send for LoadOptions<'a>
impl<'a> Sync for LoadOptions<'a>
impl<'a> Unpin for LoadOptions<'a>
impl<'a> UnsafeUnpin for LoadOptions<'a>
impl<'a> !UnwindSafe for LoadOptions<'a>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more