[][src]Trait abin::IntoUnSyncView

pub trait IntoUnSyncView {
    type Target;
    fn un_sync(self) -> Self::Target;
}

Returns the un-synchronized view of self.

See also UnSyncRef and IntoUnSync.

Associated Types

type Target

Loading content...

Required methods

fn un_sync(self) -> Self::Target

Returns the un-synchronized view of self.

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::{SBin, NewSBin, BinFactory, IntoUnSyncView, Bin, AnyBin, IntoSync};
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());

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());
    // we can also un-wrap it to be a synchronized bin again... in this case, this is
    // a cheap operation (but it's not always a cheap operation).
    let _synchronized_again : SBin = value.into_sync();
}
Loading content...

Implementors

impl IntoUnSyncView for Bin[src]

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

type Target = Bin

impl IntoUnSyncView for SBin[src]

Returns the un-synchronized view of this binary.

type Target = Bin

impl<TBin> IntoUnSyncView for AnyStr<TBin> where
    TBin: AnyBin
[src]

type Target = AnyStr<Bin>

Loading content...