Struct automerge::LoadOptions

source ·
pub struct LoadOptions<'a> { /* private fields */ }

Implementations§

source§

impl<'a> LoadOptions<'a>

source

pub fn new() -> LoadOptions<'static>

source

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

source

pub fn verification_mode(self, verification_mode: VerificationMode) -> Self

Whether to verify the head hashes after loading

The default is VerificationMode::Check

source

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

source

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.

Trait Implementations§

source§

impl<'a> Debug for LoadOptions<'a>

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl Default for LoadOptions<'static>

source§

fn default() -> Self

Returns the “default value” for a type. Read more

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> !UnwindSafe for LoadOptions<'a>

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T> Instrument for T

source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> Same for T

§

type Output = T

Should always be Self
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
source§

impl<T> WithSubscriber for T

source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more