[][src]Trait abin::UnSyncRef

pub trait UnSyncRef {
    type Target;
    fn un_sync_ref(&self) -> &Self::Target;
}

Returns the un-synchronized view of self (as reference).

See also IntoUnSyncView and IntoUnSync.

Associated Types

type Target

Loading content...

Required methods

fn un_sync_ref(&self) -> &Self::Target

Returns the un-synchronized view of self (as reference).

What does 'view' mean: The implementation is not really changed, just the interface is changed. It's still backed by a synchronized implementation.

use abin::{NewSBin, SBin, BinFactory, UnSyncRef, Bin, AnyBin};
let string = "This is some string; content of the binary.";
let sync_bin : SBin = NewSBin::copy_from_slice(string.as_bytes());
function_wants_bin(sync_bin.un_sync_ref());

fn function_wants_bin(value : &Bin) {
    // note: the 'value' here is still a synchronized binary (it just wrapped inside an
    // un-synchronized view).
    assert_eq!("This is some string; content of the binary.".as_bytes(), value.as_slice());
}
Loading content...

Implementors

impl UnSyncRef for Bin[src]

This does nothing, since Bin is already un-synchronized (view). Just returns itself.

type Target = Bin

impl UnSyncRef for SBin[src]

type Target = Bin

Loading content...