Function yrs::ydoc_write_transaction

source ·
#[no_mangle]
pub unsafe extern "C" fn ydoc_write_transaction(
    doc: *mut Doc,
    origin_len: u32,
    origin: *const c_char
) -> *mut Transaction
Expand description

Starts a new read-write transaction on a given document. All other operations happen in context of a transaction. Yrs transactions do not follow ACID rules. Once a set of operations is complete, a transaction can be finished using ytransaction_commit function.

origin_len and origin are optional parameters to specify a byte sequence used to mark the origin of this transaction (eg. you may decide to give different origins for transaction applying remote updates). These can be used by event handlers or YUndoManager to perform specific actions. If origin should not be set, call ydoc_write_transaction(doc, 0, NULL).

Returns NULL if read-write transaction couldn’t be created, i.e. when another transaction is already opened.