pub struct Automerge { /* private fields */ }Expand description
An automerge document which does not manage transactions for you.
§Creating, loading, merging and forking documents
A new document can be created with Self::new(), which will create a document with a random
ActorId. Existing documents can be loaded with Self::load(), or Self::load_with().
If you have two documents and you want to merge the changes from one into the other you can use
Self::merge() or Self::merge_and_log_patches().
If you have a document you want to split into two concurrent threads of execution you can use
Self::fork(). If you want to split a document from ealier in its history you can use
Self::fork_at().
§Reading values
Self implements ReadDoc, which provides methods for reading values from the document.
§Modifying a document (Transactions)
Automerge provides an interface for viewing and modifying automerge documents which does
not manage transactions for you. To create changes you use either Automerge::transaction() or
Automerge::transact() (or the _with variants).
§Sync
This type implements crate::sync::SyncDoc
Implementations§
Source§impl Automerge
impl Automerge
Sourcepub fn init_from_hydrate(&mut self, value: &Map) -> Result<(), AutomergeError>
pub fn init_from_hydrate(&mut self, value: &Map) -> Result<(), AutomergeError>
Overwrite the keys of the root object with the values from value
This is useful to initialize an empty document with a large initial
value. Note that existing keys which are not in value are left as is
pub fn new_with_encoding(encoding: TextEncoding) -> Self
Sourcepub fn with_actor(self, actor: ActorId) -> Self
pub fn with_actor(self, actor: ActorId) -> Self
Set the actor id for this document.
Sourcepub fn transaction(&mut self) -> Transaction<'_>
pub fn transaction(&mut self) -> Transaction<'_>
Start a transaction.
Sourcepub fn transaction_log_patches(
&mut self,
patch_log: PatchLog,
) -> Transaction<'_>
pub fn transaction_log_patches( &mut self, patch_log: PatchLog, ) -> Transaction<'_>
Start a transaction which records changes in a PatchLog
Sourcepub fn transaction_at(
&mut self,
patch_log: PatchLog,
heads: &[ChangeHash],
) -> Transaction<'_>
pub fn transaction_at( &mut self, patch_log: PatchLog, heads: &[ChangeHash], ) -> Transaction<'_>
Start a transaction isolated at a given heads
Sourcepub fn into_transaction(
self,
patch_log: Option<PatchLog>,
heads: Option<&[ChangeHash]>,
) -> OwnedTransaction
pub fn into_transaction( self, patch_log: Option<PatchLog>, heads: Option<&[ChangeHash]>, ) -> OwnedTransaction
Start a transaction that owns the document, consuming self.
This is useful when the transaction must be 'static (e.g. storing across an FFI
boundary or in a struct that requires 'static). The document is returned when the
transaction is committed or rolled back.
§Arguments
patch_log- An optionalPatchLogto log the changes in this transaction toheads- An optional set of heads to isolate this transaction at, orNoneto use the current heads of the document
Sourcepub fn transact<F, O, E>(&mut self, f: F) -> Result<O, E>
pub fn transact<F, O, E>(&mut self, f: F) -> Result<O, E>
Run a transaction on this document in a closure, automatically handling commit or rollback afterwards.
Sourcepub fn transact_with<F, O, E, C>(&mut self, c: C, f: F) -> Result<O, E>
pub fn transact_with<F, O, E, C>(&mut self, c: C, f: F) -> Result<O, E>
Like Self::transact() but with a function for generating the commit options.
Sourcepub fn transact_and_log_patches<F, O, E>(&mut self, f: F) -> Result<O, E>
pub fn transact_and_log_patches<F, O, E>(&mut self, f: F) -> Result<O, E>
Run a transaction on this document in a closure, collecting patches, automatically handling commit or rollback afterwards.
The collected patches are available in the return value of Transaction::commit()
Sourcepub fn transact_and_log_patches_with<F, O, E, C>(
&mut self,
c: C,
f: F,
) -> Result<O, E>
pub fn transact_and_log_patches_with<F, O, E, C>( &mut self, c: C, f: F, ) -> Result<O, E>
Like Self::transact_and_log_patches() but with a function for generating the commit options
Sourcepub fn empty_commit(&mut self, opts: CommitOptions) -> ChangeHash
pub fn empty_commit(&mut self, opts: CommitOptions) -> ChangeHash
Generate an empty change
The main reason to do this is if you want to create a “merge commit”, which is a change that has all the current heads of the document as dependencies.
Sourcepub fn fork(&self) -> Self
pub fn fork(&self) -> Self
Fork this document at the current point for use by a different actor.
This will create a new actor ID for the forked document
Sourcepub fn fork_at(&self, heads: &[ChangeHash]) -> Result<Self, AutomergeError>
pub fn fork_at(&self, heads: &[ChangeHash]) -> Result<Self, AutomergeError>
Fork this document at the given heads
This will create a new actor ID for the forked document
pub fn diff_opset(&self, other: &Self) -> Result<(), AutomergeError>
Sourcepub fn load(data: &[u8]) -> Result<Self, AutomergeError>
pub fn load(data: &[u8]) -> Result<Self, AutomergeError>
Load a document.
Sourcepub fn load_unverified_heads(data: &[u8]) -> Result<Self, AutomergeError>
pub fn load_unverified_heads(data: &[u8]) -> Result<Self, AutomergeError>
Load a document without verifying the head hashes
This is useful for debugging as it allows you to examine a corrupted document.
Sourcepub fn load_with(
data: &[u8],
on_error: OnPartialLoad,
mode: VerificationMode,
patch_log: &mut PatchLog,
) -> Result<Self, AutomergeError>
👎Deprecated since 0.5.2: Use load_with_options instead
pub fn load_with( data: &[u8], on_error: OnPartialLoad, mode: VerificationMode, patch_log: &mut PatchLog, ) -> Result<Self, AutomergeError>
Use load_with_options instead
Load a document, with options
§Arguments
data- The data to loadon_error- What to do if the document is only partially loaded. This can happen if some prefix ofdatacontains valid data.mode- Whether to verify the head hashes after loadingpatch_log- APatchLogto log the changes required to materialize the current state of the document once loaded
Sourcepub fn load_with_options(
data: &[u8],
options: LoadOptions<'_>,
) -> Result<Self, AutomergeError>
pub fn load_with_options( data: &[u8], options: LoadOptions<'_>, ) -> Result<Self, AutomergeError>
Load a document, with options
§Arguments
data- The data to loadoptions- The options to use when loading
Sourcepub fn make_patches(&self, patch_log: &mut PatchLog) -> Vec<Patch>
pub fn make_patches(&self, patch_log: &mut PatchLog) -> Vec<Patch>
Sourcepub fn current_state(&self) -> Vec<Patch>
pub fn current_state(&self) -> Vec<Patch>
Get a set of Patches which materialize the current state of the document
This is a convienence method for doc.diff(&[], current_heads)
Sourcepub fn load_incremental(&mut self, data: &[u8]) -> Result<usize, AutomergeError>
pub fn load_incremental(&mut self, data: &[u8]) -> Result<usize, AutomergeError>
Load an incremental save of a document.
Unlike Self::load() this imports changes into an existing document. It will work with
both the output of Self::save() and Self::save_after()
The return value is the number of ops which were applied, this is not useful and will change in future.
Sourcepub fn load_incremental_log_patches(
&mut self,
data: &[u8],
patch_log: &mut PatchLog,
) -> Result<usize, AutomergeError>
pub fn load_incremental_log_patches( &mut self, data: &[u8], patch_log: &mut PatchLog, ) -> Result<usize, AutomergeError>
Like Self::load_incremental() but log the changes to the current state of the document
to PatchLog
Sourcepub fn apply_changes(
&mut self,
changes: impl IntoIterator<Item = Change> + Clone,
) -> Result<(), AutomergeError>
pub fn apply_changes( &mut self, changes: impl IntoIterator<Item = Change> + Clone, ) -> Result<(), AutomergeError>
Apply changes to this document.
This is idempotent in the sense that if a change has already been applied it will be ignored.
Sourcepub fn apply_changes_log_patches<I: IntoIterator<Item = Change> + Clone>(
&mut self,
changes: I,
patch_log: &mut PatchLog,
) -> Result<(), AutomergeError>
pub fn apply_changes_log_patches<I: IntoIterator<Item = Change> + Clone>( &mut self, changes: I, patch_log: &mut PatchLog, ) -> Result<(), AutomergeError>
Like Self::apply_changes() but log the resulting changes to the current state of the
document to patch_log
Sourcepub fn merge(
&mut self,
other: &mut Self,
) -> Result<Vec<ChangeHash>, AutomergeError>
pub fn merge( &mut self, other: &mut Self, ) -> Result<Vec<ChangeHash>, AutomergeError>
Takes all the changes in other which are not in self and applies them
Sourcepub fn merge_and_log_patches(
&mut self,
other: &mut Self,
patch_log: &mut PatchLog,
) -> Result<Vec<ChangeHash>, AutomergeError>
pub fn merge_and_log_patches( &mut self, other: &mut Self, patch_log: &mut PatchLog, ) -> Result<Vec<ChangeHash>, AutomergeError>
Takes all the changes in other which are not in self and applies them whilst logging
the resulting changes to the current state of the document to patch_log
Sourcepub fn bundle<I>(&self, hashes: I) -> Result<Bundle, AutomergeError>where
I: IntoIterator<Item = ChangeHash>,
pub fn bundle<I>(&self, hashes: I) -> Result<Bundle, AutomergeError>where
I: IntoIterator<Item = ChangeHash>,
EXPERIMENTAL: Write the set of changes in hashes to a “bundle”
A “bundle” is a compact representation of a set of changes which uses
the same compression tricks as the document encoding we use in
Automerge::save.
This is an experimental API, the bundle format is still subject to change and so should not be used in production just yet.
Sourcepub fn save_with_options(&self, options: SaveOptions) -> Vec<u8> ⓘ
pub fn save_with_options(&self, options: SaveOptions) -> Vec<u8> ⓘ
Save the entirety of this document in a compact form.
Sourcepub fn save_and_verify(&self) -> Result<Vec<u8>, AutomergeError>
pub fn save_and_verify(&self) -> Result<Vec<u8>, AutomergeError>
Save the document and attempt to load it before returning - slow!
Sourcepub fn save_nocompress(&self) -> Vec<u8> ⓘ
pub fn save_nocompress(&self) -> Vec<u8> ⓘ
Save this document, but don’t run it through DEFLATE afterwards
Sourcepub fn save_after(&self, heads: &[ChangeHash]) -> Vec<u8> ⓘ
pub fn save_after(&self, heads: &[ChangeHash]) -> Vec<u8> ⓘ
Save the changes since the given heads
The output of this will not be a compressed document format, but a series of individual
changes. This is useful if you know you have only made a small change since the last
Self::save() and you want to immediately send it somewhere (e.g. you’ve inserted a
single character in a text object).
Sourcepub fn get_last_local_change(&self) -> Option<Change>
pub fn get_last_local_change(&self) -> Option<Change>
Get the last change this actor made to the document.
pub fn dump(&self)
Sourcepub fn diff(
&self,
before_heads: &[ChangeHash],
after_heads: &[ChangeHash],
) -> Vec<Patch>
pub fn diff( &self, before_heads: &[ChangeHash], after_heads: &[ChangeHash], ) -> Vec<Patch>
Create patches representing the change in the current state of the document between the
before and after heads. If the arguments are reverse it will observe the same changes
in the opposite order.
Sourcepub fn diff_obj(
&self,
obj: &ExId,
before_heads: &[ChangeHash],
after_heads: &[ChangeHash],
recursive: bool,
) -> Result<Vec<Patch>, AutomergeError>
pub fn diff_obj( &self, obj: &ExId, before_heads: &[ChangeHash], after_heads: &[ChangeHash], recursive: bool, ) -> Result<Vec<Patch>, AutomergeError>
Create patches representing the change in the current state of an object
in the document between the before_heads and after_heads heads. If
the arguments are reverse it will observe the same changes in the
opposite order.
§Arguments
obj- The object to start the diff at.before_heads- heads fromSelf::get_heads()at beginning point in the documents historyafter_heads- heads fromSelf::get_heads()at ending point in the documents history.recursive- if false, do not also diff child objects
Note: before_heads and after_heads do not have to be chronological.
Document state can move backward.
Sourcepub fn get_heads(&self) -> Vec<ChangeHash>
pub fn get_heads(&self) -> Vec<ChangeHash>
Get the heads of this document.
pub fn get_changes(&self, have_deps: &[ChangeHash]) -> Vec<Change>
pub fn get_changes_meta( &self, have_deps: &[ChangeHash], ) -> Vec<ChangeMetadata<'_>>
pub fn get_change_meta_by_hash( &self, hash: &ChangeHash, ) -> Option<ChangeMetadata<'_>>
Sourcepub fn get_changes_added(&self, other: &Self) -> Vec<Change>
pub fn get_changes_added(&self, other: &Self) -> Vec<Change>
Get changes in other that are not in self
Sourcepub fn hash_for_opid(&self, exid: &ExId) -> Option<ChangeHash>
pub fn hash_for_opid(&self, exid: &ExId) -> Option<ChangeHash>
Get the hash of the change that contains the given opid.
Returns None if the opid:
- is the root object id
- does not exist in this document
pub fn hydrate(&self, heads: Option<&[ChangeHash]>) -> Value
Sourcepub fn has_our_changes(&self, other: &State) -> bool
pub fn has_our_changes(&self, other: &State) -> bool
Whether the peer represented by other has all the changes we have
pub fn text_encoding(&self) -> TextEncoding
Source§impl Automerge
impl Automerge
pub fn apply_changes_batch( &mut self, changes: impl IntoIterator<Item = Change> + Clone, ) -> Result<(), AutomergeError>
pub fn apply_changes_batch_log_patches<I: IntoIterator<Item = Change>>( &mut self, changes: I, log: &mut PatchLog, ) -> Result<(), AutomergeError>
Trait Implementations§
Source§impl ReadDoc for Automerge
impl ReadDoc for Automerge
Source§fn parents<O: AsRef<ExId>>(&self, obj: O) -> Result<Parents<'_>, AutomergeError>
fn parents<O: AsRef<ExId>>(&self, obj: O) -> Result<Parents<'_>, AutomergeError>
Source§fn parents_at<O: AsRef<ExId>>(
&self,
obj: O,
heads: &[ChangeHash],
) -> Result<Parents<'_>, AutomergeError>
fn parents_at<O: AsRef<ExId>>( &self, obj: O, heads: &[ChangeHash], ) -> Result<Parents<'_>, AutomergeError>
Source§fn keys<O: AsRef<ExId>>(&self, obj: O) -> Keys<'_> ⓘ
fn keys<O: AsRef<ExId>>(&self, obj: O) -> Keys<'_> ⓘ
obj. Read moreSource§fn map_range<'a, O: AsRef<ExId>, R: RangeBounds<String> + 'a>(
&'a self,
obj: O,
range: R,
) -> MapRange<'a> ⓘ
fn map_range<'a, O: AsRef<ExId>, R: RangeBounds<String> + 'a>( &'a self, obj: O, range: R, ) -> MapRange<'a> ⓘ
obj in the given range. Read moreSource§fn map_range_at<'a, O: AsRef<ExId>, R: RangeBounds<String> + 'a>(
&'a self,
obj: O,
range: R,
heads: &[ChangeHash],
) -> MapRange<'a> ⓘ
fn map_range_at<'a, O: AsRef<ExId>, R: RangeBounds<String> + 'a>( &'a self, obj: O, range: R, heads: &[ChangeHash], ) -> MapRange<'a> ⓘ
Source§fn list_range<O: AsRef<ExId>, R: RangeBounds<usize>>(
&self,
obj: O,
range: R,
) -> ListRange<'_> ⓘ
fn list_range<O: AsRef<ExId>, R: RangeBounds<usize>>( &self, obj: O, range: R, ) -> ListRange<'_> ⓘ
obj in the given range. Read moreSource§fn list_range_at<O: AsRef<ExId>, R: RangeBounds<usize>>(
&self,
obj: O,
range: R,
heads: &[ChangeHash],
) -> ListRange<'_> ⓘ
fn list_range_at<O: AsRef<ExId>, R: RangeBounds<usize>>( &self, obj: O, range: R, heads: &[ChangeHash], ) -> ListRange<'_> ⓘ
obj in the given range as at heads Read moreSource§fn values<O: AsRef<ExId>>(&self, obj: O) -> Values<'_> ⓘ
fn values<O: AsRef<ExId>>(&self, obj: O) -> Values<'_> ⓘ
Source§fn values_at<O: AsRef<ExId>>(&self, obj: O, heads: &[ChangeHash]) -> Values<'_> ⓘ
fn values_at<O: AsRef<ExId>>(&self, obj: O, heads: &[ChangeHash]) -> Values<'_> ⓘ
heads Read moreSource§fn length<O: AsRef<ExId>>(&self, obj: O) -> usize
fn length<O: AsRef<ExId>>(&self, obj: O) -> usize
Source§fn length_at<O: AsRef<ExId>>(&self, obj: O, heads: &[ChangeHash]) -> usize
fn length_at<O: AsRef<ExId>>(&self, obj: O, heads: &[ChangeHash]) -> usize
heads Read moreSource§fn text<O: AsRef<ExId>>(&self, obj: O) -> Result<String, AutomergeError>
fn text<O: AsRef<ExId>>(&self, obj: O) -> Result<String, AutomergeError>
Source§fn spans<O: AsRef<ExId>>(&self, obj: O) -> Result<Spans<'_>, AutomergeError>
fn spans<O: AsRef<ExId>>(&self, obj: O) -> Result<Spans<'_>, AutomergeError>
objSource§fn spans_at<O: AsRef<ExId>>(
&self,
obj: O,
heads: &[ChangeHash],
) -> Result<Spans<'_>, AutomergeError>
fn spans_at<O: AsRef<ExId>>( &self, obj: O, heads: &[ChangeHash], ) -> Result<Spans<'_>, AutomergeError>
obj as at headsSource§fn get_cursor<O: AsRef<ExId>, I: Into<CursorPosition>>(
&self,
obj: O,
position: I,
at: Option<&[ChangeHash]>,
) -> Result<Cursor, AutomergeError>
fn get_cursor<O: AsRef<ExId>, I: Into<CursorPosition>>( &self, obj: O, position: I, at: Option<&[ChangeHash]>, ) -> Result<Cursor, AutomergeError>
usize position in a Sequence (either ObjType::List or ObjType::Text). Read moreSource§fn get_cursor_moving<O: AsRef<ExId>, I: Into<CursorPosition>>(
&self,
obj: O,
position: I,
at: Option<&[ChangeHash]>,
move_cursor: MoveCursor,
) -> Result<Cursor, AutomergeError>
fn get_cursor_moving<O: AsRef<ExId>, I: Into<CursorPosition>>( &self, obj: O, position: I, at: Option<&[ChangeHash]>, move_cursor: MoveCursor, ) -> Result<Cursor, AutomergeError>
usize position in a Sequence (either ObjType::List or ObjType::Text). Read moreSource§fn get_cursor_position<O: AsRef<ExId>>(
&self,
obj: O,
cursor: &Cursor,
at: Option<&[ChangeHash]>,
) -> Result<usize, AutomergeError>
fn get_cursor_position<O: AsRef<ExId>>( &self, obj: O, cursor: &Cursor, at: Option<&[ChangeHash]>, ) -> Result<usize, AutomergeError>
Source§fn text_at<O: AsRef<ExId>>(
&self,
obj: O,
heads: &[ChangeHash],
) -> Result<String, AutomergeError>
fn text_at<O: AsRef<ExId>>( &self, obj: O, heads: &[ChangeHash], ) -> Result<String, AutomergeError>
heads, see
Self::text()Source§fn marks<O: AsRef<ExId>>(&self, obj: O) -> Result<Vec<Mark>, AutomergeError>
fn marks<O: AsRef<ExId>>(&self, obj: O) -> Result<Vec<Mark>, AutomergeError>
Source§fn marks_at<O: AsRef<ExId>>(
&self,
obj: O,
heads: &[ChangeHash],
) -> Result<Vec<Mark>, AutomergeError>
fn marks_at<O: AsRef<ExId>>( &self, obj: O, heads: &[ChangeHash], ) -> Result<Vec<Mark>, AutomergeError>
fn hydrate<O: AsRef<ExId>>( &self, obj: O, heads: Option<&[ChangeHash]>, ) -> Result<Value, AutomergeError>
fn get_marks<O: AsRef<ExId>>( &self, obj: O, index: usize, heads: Option<&[ChangeHash]>, ) -> Result<MarkSet, AutomergeError>
Source§fn get<O: AsRef<ExId>, P: Into<Prop>>(
&self,
obj: O,
prop: P,
) -> Result<Option<(Value<'_>, ExId)>, AutomergeError>
fn get<O: AsRef<ExId>, P: Into<Prop>>( &self, obj: O, prop: P, ) -> Result<Option<(Value<'_>, ExId)>, AutomergeError>
Source§fn get_at<O: AsRef<ExId>, P: Into<Prop>>(
&self,
obj: O,
prop: P,
heads: &[ChangeHash],
) -> Result<Option<(Value<'_>, ExId)>, AutomergeError>
fn get_at<O: AsRef<ExId>, P: Into<Prop>>( &self, obj: O, prop: P, heads: &[ChangeHash], ) -> Result<Option<(Value<'_>, ExId)>, AutomergeError>
heads, see Self::get()Source§fn get_all<O: AsRef<ExId>, P: Into<Prop>>(
&self,
obj: O,
prop: P,
) -> Result<Vec<(Value<'_>, ExId)>, AutomergeError>
fn get_all<O: AsRef<ExId>, P: Into<Prop>>( &self, obj: O, prop: P, ) -> Result<Vec<(Value<'_>, ExId)>, AutomergeError>
Source§fn get_all_at<O: AsRef<ExId>, P: Into<Prop>>(
&self,
obj: O,
prop: P,
heads: &[ChangeHash],
) -> Result<Vec<(Value<'_>, ExId)>, AutomergeError>
fn get_all_at<O: AsRef<ExId>, P: Into<Prop>>( &self, obj: O, prop: P, heads: &[ChangeHash], ) -> Result<Vec<(Value<'_>, ExId)>, AutomergeError>
heads Read moreSource§fn object_type<O: AsRef<ExId>>(&self, obj: O) -> Result<ObjType, AutomergeError>
fn object_type<O: AsRef<ExId>>(&self, obj: O) -> Result<ObjType, AutomergeError>
Source§fn get_missing_deps(&self, heads: &[ChangeHash]) -> Vec<ChangeHash>
fn get_missing_deps(&self, heads: &[ChangeHash]) -> Vec<ChangeHash>
heads.Source§fn get_change_by_hash(&self, hash: &ChangeHash) -> Option<Change>
fn get_change_by_hash(&self, hash: &ChangeHash) -> Option<Change>
fn text_encoding(&self) -> TextEncoding
Source§impl SyncDoc for Automerge
impl SyncDoc for Automerge
Source§fn generate_sync_message(&self, sync_state: &mut State) -> Option<Message>
fn generate_sync_message(&self, sync_state: &mut State) -> Option<Message>
sync_state Read moreSource§fn receive_sync_message(
&mut self,
sync_state: &mut State,
message: Message,
) -> Result<(), AutomergeError>
fn receive_sync_message( &mut self, sync_state: &mut State, message: Message, ) -> Result<(), AutomergeError>
sync_stateSource§fn receive_sync_message_log_patches(
&mut self,
sync_state: &mut State,
message: Message,
patch_log: &mut PatchLog,
) -> Result<(), AutomergeError>
fn receive_sync_message_log_patches( &mut self, sync_state: &mut State, message: Message, patch_log: &mut PatchLog, ) -> Result<(), AutomergeError>
sync_state, logging any changes that
are made to patch_log Read moreAuto Trait Implementations§
impl Freeze for Automerge
impl RefUnwindSafe for Automerge
impl Send for Automerge
impl Sync for Automerge
impl Unpin for Automerge
impl UnsafeUnpin for Automerge
impl UnwindSafe for Automerge
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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