Crate instance_copy_on_write

Crate instance_copy_on_write 

Source
Expand description
  • 
    let val = 
        ICoW::new(TestStruct::new(1, 2));
    
    // read only 
    let read1 = val.read();
    //..
    drop(read1);
    
    // ...
    
    // copy on write NON-exclusively, read is possible
    let mut transaction = val.clone();
    
    transaction.start = 5;
    transaction.stop = 6;
    
    // update, after calling this function, all reades who 
    // read before will still see old version.
    // all reades after, new
    transaction.commit();
    //or
    drop(transaction); // to drop changes
    
    
    // exclusive lock, read is also not possible
    
    let res = val.clone_exclusivly();
    // ..
    // commit changes releasing lock
    commit(val); //or
    drop(val); // to drop changes and release lock
    

Re-exports§

pub use cow_mutex::ICoW;
pub use cow_mutex::ICoWRead;
pub use cow_mutex::ICoWCopy;
pub use cow_mutex::ICoWLock;

Modules§

cow_mutex
A RwLock based copy-on-write.

Enums§

ICoWError
Errors which may be returned.
ICoWLockTypes
Type of the sync code.